String
string result = "<?xml version=\" 1.0\ "encoding=\" utf-8\ "? ><speed><is_success>t</is_success ><response><protocol><partner>123456</partner><sign>123456</sign>< sign_type>md5</sign_type><timestamp>20090707122322</timestamp><version>1.0</ Version></protocol></response></speed> ";
Conversion format
var xdoc = new XmlDocument ();
Parse an XML
Xdoc. LOADXML (result);
XmlNode xnode = Xdoc. selectSingleNode ("speed/is_success");//Take the value of the Is_success node
string is_success = Xnode.innertext;
Info. ADD ("Is_success", Xnode.innertext);
T means success F means failure
if (is_success = = "T")
{
XmlNode XmlNode = Xdoc. selectSingleNode ("Speed/response/protocol");//Take the value of the Protocol node
XmlNodeList xmlList = xmlnode.childnodes;//Get node
Loop node
foreach (XmlElement item in xmlList)
{
Info. ADD (item. Name, item. InnerText);
}
}
C # XML parsing values