将xml字符串转化为正确的xml文档并读取其中的节点?!!!!!!!!!!!急!
我接受一堆xml字符串,如下:
" <?xml version=\ "1.0\ "encoding=\ "GB2312\ "?> \n <WAResponseXML> <UserInfo> 12010|1175224857422|44D6F8A8152B0EACBAE1E05144A3F439|218.249.69.130|HAA00123456 </UserInfo> \n <ActionInfo CheckCode=\ "\ " CurrVal=\ "0.0\ " ErrorInfo=\ "7\ " ResultID=\ "0\ " WholeVal=\ "0.0\ "/> \n <Date> 2007-03-30 11:27:43 </Date> \n <Key> B309382CF8B3A913CF43EFC3A09745F7 </Key> \n </WAResponseXML> \n "
我怎么将它转化为正确的xml文档格式,并正常读取其中的节点呢?
这里还有很多转换符,我怎么去掉它呀?
------解决方案--------------------string strXml = " <?xml version=\ "1.0\ "encoding=\ "GB2312\ "?> \n <WAResponseXML> <UserInfo> 12010|1175224857422|44D6F8A8152B0EACBAE1E05144A3F439|218.249.69.130|HAA00123456 </UserInfo> \n <ActionInfo CheckCode=\ "\ " CurrVal=\ "0.0\ " ErrorInfo=\ "7\ " ResultID=\ "0\ " WholeVal=\ "0.0\ "/> \n <Date> 2007-03-30 11:27:43 </Date> \n <Key> B309382CF8B3A913CF43EFC3A09745F7 </Key> \n </WAResponseXML> \n ";
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
xd.LoadXml(strXml)
------解决方案--------------------不用管那些转义字符,定义一个xmldocument doc
记得好像是这个吧 doc.locdxml(yourstring)