如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>
C#代码
String path = System.AppDomain.CurrentDomain.BaseDirectory + "//return.xml"; XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(path); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xmldoc.NameTable); //namespace namespaceManager.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;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。