Find nodes by name
using System;
using System.Xml;
public class MainClass
{
[STAThread]
private static void Main()
{
XmlDocument doc = new XmlDocument();
doc.Load(@"Sample.xml");
XmlNodeList prices = doc.GetElementsByTagName("productPrice");
XmlNode product = doc.GetElementsByTagName("products")[0];
//XmlNode price = ((XmlElement)product).GetElementsByTagName("productPrice")[0];
foreach (XmlNode price in prices)
{
Console.WriteLine(price.ChildNodes[0].Value);
}
}
}
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
-
-
-
-
|