Let's say you have XML as
To parse it we use the .NET XmlDocument class:
<root>
<item>
<name1>value1</name1>
<name2>value2</name2>
<name3>value3</name3>
</item>
<item>
<name1>value1</name1>
<name2>value2</name2>
</item>
</root>
To parse it we use the .NET XmlDocument class:
// Create the XmlDocument object
XmlDocument xmlDoc = new XmlDocument();
// Load the Xml into the object
xmlDoc.Load(objResponse.GetResponseStream());
// Get the element like it was a path
XmlNode errorNode = xmlDoc.SelectSingleNode("root/item/name1");
if (errorNode != null)
{
litResult.Text = errorNode.InnerText;
return;
}
Comments