如XML文件:
- <?xml version="1.0" encoding="utf-8" ?>
- <SendExResp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <PayCount>1</PayCount>
- <BlackWords />
- <ErrorMobiles />
- <BlackMobiles />
- <BatchSendID>00000000-0000-0000-0000-000000000000</BatchSendID>
- <Result>aaa</Result>
- <ErrorDesc>成功</ErrorDesc>
- </SendExResp>@H_404_7@
C#代码
String path = System.AppDomain.CurrentDomain.BaseDirectory + "//return.xml";
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(path);
XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xmldoc.NaMetable); //namespacenamespaceManager.AddNamespace("xsi","http://www.w3.org/2001/XMLSchema-instance");
namespaceManager.AddNamespace("xsd","http://www.w3.org/2001/XMLSchema");
XmlNode node = xmldoc.SelectSingleNode("//SendExResp/Result",namespaceManager);
this.Label1.Text = node.InnerText;
@H_404_7@