Jump to content
riverwalker

How do I retrieve inner (child) nodes

Recommended Posts

Hi; Given this XML . <SUPAPPRAISER> <INSPECTION> <STATECERT> <NUM>12456789</NUM> </STATECERT> </INSPECTION></SUPAPPRAISER> I want to store the Num node value in an variable. I tried the XML DOM tutorial and example but they aren't exactly working with my code. This is asp.net 4.0 XmlNodeList elem_SupAppraiser = incomingxml_doc.GetElementsByTagName("SUPAPPRAISER");string hold = elem_SupAppraiser.Item(0).Value; if (elem_SupAppraiser != null && elem_SupAppraiser[0] != null){SuprAppra_Cert = elem_SupAppraiser[0].InnerText; What expression am I missing ? Thanks

Share this post


Link to post
Share on other sites

can you not just do

GetElementsByTagName('NUM')

otherwise, you would probably have to start at the root and slowly iterate your way down the nodes till you get to NUM

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...