I have an cXML that I am trying to read some values from.... I can read the node values using following code. But I am having hard time reading the "payloadID" from the same document. Any suggestions how to go about it?
XmlDocument xmlRequest = new XmlDocument();
XmlNodeList name = xmlRequest.GetElementsByTagName("NetworkID");
string sSecret = name[0].InnerText;
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.023/cXML.dtd">
<cXML payloadID="1348609345562-715426217594539696@216.109.111.69"
timestamp="2012-09-11T11:55:53-07:00" version="1.2.023"
xml:lang="en-US">
<From>
<Credential domain="NetworkID">
<Identity>tnt</Identity>
</Credential>
</From>
<To>
<Credential domain="NetworkID1">
<Identity>abc</Identity>
</Credential>
</To>
</cXML>
You should be able to get the root element and then use its Attributes property to read the attributes of that root element, e.g.:
XmlNode root = doc.SelectSingleNode("/cXML");
string attrVal = root.Attributes["payloadID"].Value;