c# - Iteration in Xmldocument -


<root> <person name="tom">   <car name="car1" />   <car name="car2" /> </person> <person name="sally">  <car name="car3" />   <car name="car4" /> </person> </root> 

i using selectnodes() method traverse. having trouble itterating 2 levels down names of cars.

 var people = xmldoc.selectnodes("/root/person");  foreach (xmlnode person in people )  {    var cars = person.selectnodes("/car");    foreach(xmlnode car in cars)     {       //get name of car     }  } 

the statement person.selectnodes("/car") not return results.

remove / xpath when selecting car


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -