Querying with an XML document
-
XPath
//Country/Continent/text()[ancestor::*/CNo/text() = '?']
replace the '?' charcter with the number for the selected country
led mike
Mike, Your query won't work. Since you know the country you can find the 'Country' child node of the parent (which happens to be 'Country' too), and, then, you can access its sibling 'Continent' node: //Country[Country='Afghanistan']/Continent
-
Mike, Your query won't work. Since you know the country you can find the 'Country' child node of the parent (which happens to be 'Country' too), and, then, you can access its sibling 'Continent' node: //Country[Country='Afghanistan']/Continent
-
Mike, Your query won't work. Since you know the country you can find the 'Country' child node of the parent (which happens to be 'Country' too), and, then, you can access its sibling 'Continent' node: //Country[Country='Afghanistan']/Continent
-
Thanks Mike, Will try out the solution you have suggested. Is there anyway I can do this using XMLTextReader... Regards, Vinu
-
Mike, Your query won't work. Since you know the country you can find the 'Country' child node of the parent (which happens to be 'Country' too), and, then, you can access its sibling 'Continent' node: //Country[Country='Afghanistan']/Continent
-
Here is another
//Country[CNo = '?']/Continent/text()
XPath is pretty nice eh? :-D I always run these before I post them.
led mike
:-> My bad! Your code didn't seem correct to me. I am sorry.
-
:-> My bad! Your code didn't seem correct to me. I am sorry.
-
Thanks Mike, Will try out the solution you have suggested. Is there anyway I can do this using XMLTextReader... Regards, Vinu
If you are using .NET Framework 1.1, it is XmlTextReader. If you are using .NET Framework 2.0, it is XmlReader. Anyway, you query differently with XmlTextReader/XmlReader since it uses a pull technique. However, you can get the same results but you have to do more coding. http://www.codeproject.com/useritems/XmlTextReader.asp[^]
-
George L. Jackson wrote:
Your code didn't seem correct to me.
No sweat. It never seems right to me that's why I always run it. :laugh:
led mike
-
Here is another
//Country[CNo = '?']/Continent/text()
XPath is pretty nice eh? :-D I always run these before I post them.
led mike