I have this simple xml file which wont ever get beyong 3 nodes deep. I need
to get the value of the child node of any node with an id of '63'. So fir
instance I would be returned 'False' from the example below.
Ive attached an XML snippet and a cC# code snippet. The piece of code is not
working as I am not too familiour with parsing XML files.I think I need to
load the attributes into an array and loop through them to check for that
value. Could anyone help me with this? Is there an wasier way?
Thanks,
Grant
-------Sample XML-----------------
<session-data>
<attr-inst id="p1" state="known">
<val>Wilma Flintstone</val>
</attr-inst>
<attr-inst id="63" state="known">
<val>false</val>
</attr-inst>
</session-data>
----------Sample C# Code------------
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(fileName);
XmlNodeList nodeList = xmlDoc.SelectNodes("//session-data/attr-inst");
foreach (XmlNode node in nodeList)
{
if ( node.Attributes["id"].Attributes == "63")
{
node.Attributes["id"].FirstChild.Value = newDate;
}
}