Hi guys good day. I have this trouble about selecting multiple nodes in an xml file.
Code:
<record>
    <cat>hw</cat>
    <subcat>monitoring</subcat>
    <Name>drives</Name>
    <Index>0</Index>
    <Type>array</Type>
    <Value>IDE\DiskST340014A</Value>
  </record>
i.e I want to select the value of Index and Value.
What I have here is just select a single value of a certain node. I've tried putting + sign ("//record[Name='drives']/Index + /Value"but no luck. Any idea?
Code:
XmlTextReader xtr = new XmlTextReader("c:/sample.xml");
			XPathDocument xpath = new XPathDocument(xtr, XmlSpace.Preserve);
			XPathNavigator xnav = xpath.CreateNavigator();
			string strquery = "//record[Name='drives']/Index";			
			XPathNodeIterator ite = xnav.Select(strquery);
			while(ite.MoveNext()){
				Console.WriteLine(ite.Current.Value);
			}