473,382 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

SEARCH XML ATTRIBUTE BASED ON THE VALUE OF ANOTHER ATTRIBUTE

<ITPL>
-<GATE NAME="2">
<SLOT SNO="5" TYPE="2" STATUS="VACANT">
<SLOT SNO="6" TYPE="2" STATUS="VACANT">
<SLOT SNO="7" TYPE="4" STATUS="VACANT"><VEHICLE VNO="5" TYPE="2"
MODEL="BOLERO" />
<SLOT SNO="8" TYPE="2" STATUS="VACANT">
</GATE>
</ITPL>

For the above file how can i query the slot sno for vmodel="Bolero"?

--
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #1
2 1274
You should look at using XPath or XQuery,

You can learn all about it at the following addresses;

http://www.w3schools.com/xquery/default.asp
http://www.w3schools.com/xpath/default.asp

These methods allow you to query and traverse xml data in an xmldocument. I
think this will provide you with everything you need to do.

An example of querying an xml document would be the following using XQuery
"doc("books.xml")/bookstore/book[price<30]""ATLANTA PATNAIK via
DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote in message
news:ed******************************@DotNetMonste r.com...
<ITPL>
-<GATE NAME="2">
<SLOT SNO="5" TYPE="2" STATUS="VACANT">
<SLOT SNO="6" TYPE="2" STATUS="VACANT">
<SLOT SNO="7" TYPE="4" STATUS="VACANT"><VEHICLE VNO="5" TYPE="2"
MODEL="BOLERO" />
<SLOT SNO="8" TYPE="2" STATUS="VACANT">
</GATE>
</ITPL>

For the above file how can i query the slot sno for vmodel="Bolero"?

--
Message posted via http://www.dotnetmonster.com

Nov 17 '05 #2
ATLANTA PATNAIK via DotNetMonster.com <fo***@nospam.DotNetMonster.com>
wrote:
<ITPL>
-<GATE NAME="2">
<SLOT SNO="5" TYPE="2" STATUS="VACANT">
<SLOT SNO="6" TYPE="2" STATUS="VACANT">
<SLOT SNO="7" TYPE="4" STATUS="VACANT"><VEHICLE VNO="5" TYPE="2"
MODEL="BOLERO" />
<SLOT SNO="8" TYPE="2" STATUS="VACANT">
</GATE>
</ITPL>

For the above file how can i query the slot sno for vmodel="Bolero"?


By looking at the XPath query I gave you before, reading the
documentation for XPath, and adapting it appropriately.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: horos | last post by:
hey all, Ok, a related question to my previous one on data dumpers for postscript. In the process of putting a form together, I'm using a lot of placeholder variables that I really don't care...
36
by: spence | last post by:
Hi All How do I make it so that when a user clicks in a search text field, the default entry (in this case "Search") is removed automatically - they are then faced with a blank search box and...
2
by: Bill Cohagan | last post by:
In my app I'm validating an XML file against an XSD which contains several attribute default value specifications. I'm performing the validation via an xml document load() using a...
4
by: Martin Lacoste | last post by:
(Access 2000) Two issues: Within a query, I need to return a field name as data (see eg. below). I need to search within 80 fields (same criteria) - is there a way to avoid 80 separate...
8
by: Steph | last post by:
Hi. I'm very new to MS Access and have been presented with an Access database of contacts by my employer. I am trying to redesign the main form of the database so that a button entitled...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
2
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to start, pause and resume a recurrsive search exactly where you left off, say in the registry programmatically? -- Michael Bragg,...
3
by: Eric Mahurin | last post by:
Is there a standard way to get a descriptor object for an arbitrary object attribute - independent of whether it uses the descriptor/ property protocol or not. I want some kind of...
12
by: iahamed | last post by:
Hi Everyone, I got two parts of my advance search to work, I am running out of Logic to connect the third. My mind is in swing! Pleaseeeeeeeee Help me. I have 3 Fiels to search, the First two...
1
by: naga01 | last post by:
Hi all, I have an XML in which i need to validate the attribute values based on another attribute value of the same tag. For Example <Employees...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.