Re: Using XPath Against A Node
- From: "FishingScout" <fishingscout@xxxxxxxxxxx>
- Date: 5 Dec 2006 21:30:52 -0800
Derek,
I am not sure what you meant by: "and I could assume that the top part
of that node was the new parent."
Using "/" will search the document root node immediate descendants.
Using "./" will search the context node immediate descendants.
Using "// will search anywhere in the entire document.
Using ".//" will search anywhere in the context node descendants.
Similarly, you could use "descendant::".
If you know the absolute path of the data you are looking for, you can
simply skip the "//" or the "/". For example, if "Price" were an
attribute of "Model", which is an immediate descendant of Vehicles, you
could query for the price of a model using "Model/@Price". If you are
a high paid developer you could search for a specific model using
"Model[.='Cadillac']/@Price". You don't need to use ".//Model/@Price"
or "descendant::Model/@Price".
I don't know if this was helpful but .... I don't drive a Cadillac.
Derek Hart wrote:
I bring in an xml file into vb.net by using xmlDoc.LoadXml(XMLString) - I
run xpath statements against the xml file to grab data from it, so I use, as
an example, //Vehicles/Vehicles/@make to get the make of the car. But then
I pass a specific node from xmlDoc into another function, not the whole
xmlDoc, just a node from it. And if I run an xpath against it, I have to
use .// (has a period at the beginning) so it does not grab info from the
parent. So I would have to use .//Vehicles/Vehicles/@make so it references
the current node. I would think that if I passed a node to a vb.net
function, I could simply use an xpath statement that would work off the
passed in node, and I could assume that the top part of that node was the
new parent. Is there a way to pass a node like this?
Derek
.
- Follow-Ups:
- Re: Using XPath Against A Node
- From: Derek Hart
- Re: Using XPath Against A Node
- References:
- Using XPath Against A Node
- From: Derek Hart
- Using XPath Against A Node
- Prev by Date: Re: FSO equivalent in VB.net
- Next by Date: Re: how to use table in a dataset as data source for combobox?
- Previous by thread: Using XPath Against A Node
- Next by thread: Re: Using XPath Against A Node
- Index(es):
Relevant Pages
|