XML读取(string形式进行读取)

#region 测试XML二进制读取
string strXmlData = "<xml><ToUserName><![CDATA[gh_ef65912f88f1]]></ToUserName>";
strXmlData += "<FromUserName><![CDATA[ozD0duP8IqRE6xUsTyjwoD9fM6wY]]></FromUserName> ";
strXmlData += "<CreateTime>1415064615</CreateTime> ";
strXmlData += "<MsgType><![CDATA[event]]></MsgType> ";
strXmlData += "<Event><![CDATA[subscribe]]></Event> ";
strXmlData += "<EventKey><![CDATA[]]></EventKey> ";
strXmlData += "</xml> "; 
XmlDocument xdt = new XmlDocument();
xdt.Load(new MemoryStream(System.Text.Encoding.GetEncoding("GB2312").GetBytes(strXmlData)));
XmlNode xn = xdt.SelectSingleNode("/xml/ToUserName");
Response.Write(xn.InnerText);
#endregion

 

posted @ 2014-11-10 14:51  xyzhuzhou  阅读(708)  评论(0编辑  收藏  举报