Jump to content

How do I retrieve inner (child) nodes


riverwalker
 Share

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

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...