Can't get XmlDocument.SelectNodes to retrieve value?



XML Document:



<HotelValuedAvailRS xmlns="http://ift.tt/1erYOQp" xmlns:xsi="http://ift.tt/ra1lAU" xsi:schemaLocation="http://ift.tt/1erYOQp HotelValuedAvailRS.xsd" timeToExpiration="1799971" totalItems="90" echoToken="DummyEchoToken">
<AuditData>
<ProcessTime>275</ProcessTime>
<Timestamp>2014-11-04 11:39:28.253</Timestamp>
<RequestHost>54.169.51.224</RequestHost>
<ServerName>FORM</ServerName>
<ServerId>FO</ServerId>
<SchemaRelease>2005/06</SchemaRelease>
<HydraCoreRelease>2014.07.10.PCI</HydraCoreRelease>
<HydraEnumerationsRelease>N/A</HydraEnumerationsRelease>
<MerlinRelease>N/A</MerlinRelease>
</AuditData>
<PaginationData currentPage="1" totalPages="5"/>
</HotelValuedAvailRS>


C# Code:



XmlDocument xdcDocument = new XmlDocument();

xdcDocument.Load(@"E:\\Hotel.xml");

XmlElement xelRoot = xdcDocument.DocumentElement;
XmlNodeList listOfContacts = xdcDocument.SelectNodes("/HotelValuedAvailRS/ServiceHotel/HotelInfo");
foreach (XmlNode xndNode in listOfContacts)
{
string name = xndNode["Name"].InnerText;
string order = xndNode["Order"].InnerText;
}


I am not getting any details from the XML above with the above code. Please help me.


No comments:

Post a Comment