Try this

xnodes = xnav.Select("/Phonelist/address[firstname =""Farhan""]/cellphone")

to get the cellphone tag from the user that matches your criterium

in every part within the path /.../.../  you can go more specific and deeper
in the xml structure so /Phonelist/address[firstname =""Farhan""]"
gives you the address of a specific user and everything underneath it, and
/Phonelist/address[firstname =""Farhan""]/cellphone") gives you the
cellphone tag + contents of that tag

hth,
 Darwin Leung

-----Original Message-----
From: Farhan Shah [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 03, 2002 5:11 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET] XPath Query Help

I can sucessfully returning the correct string using XPath, but not sure
how to select inner node in XML.

Following is how my XML looks like:
<Phonelist>
 <address aid='1'>
  <firstname>Farhan</firstname>
  <lastname>Shah</lastname>
  <ext>237</ext>
  <cellphone>5132263305</cellphone>
  <clientphone></clientphone>
  <voicemail>309</voicemail>
  <email>fshah</email>
  <password>12345</password>
  <pin>1234</pin>
 </address>
</Phonelist>

and following is how my code looks like:

        Dim xdoc As New XPathDocument(Server.MapPath("phonenumbers.xml"))
        Dim xnav As XPathNavigator
        Dim xnodes As XPathNodeIterator

        xnav = xdoc.CreateNavigator()
        xnodes = xnav.Select("/Phonelist/address[firstname =""Farhan""]")

        Response.Write(xnodes.Current.ToString())

I want to select "Cellphone" Node etc. how will i do that?

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to