i have this xml
and i want to read the value of id. i thought this would do it, but it doesn't
the statement line is the code i wrote to make sure i had the node the right node. the foreach is for later
how to i get the value of the id attribute?
Code:
<html id="sample">
some <i>text</i>
</html>
and i want to read the value of id. i thought this would do it, but it doesn't
Code:
XmlDocument contentFile = new XmlDocument();
contentFile.Load(Server.MapPath("Index.xml"));
foreach(XmlNode node in contentFile.ChildNodes)
{
//Console.WriteLine(node.InnerXml);
Console.WriteLine(node.Attributes["id"]);
}
the statement line is the code i wrote to make sure i had the node the right node. the foreach is for later
how to i get the value of the id attribute?