【问题标题】:Get value soapxml in XDocument [duplicate]在XDocument中获取值soapxml [重复]
【发布时间】:2015-06-02 22:45:54
【问题描述】:

我有一个来自网络服务的结果,但无法获取值。

  string result = responseReader.ReadToEnd();
  ResultXML = XDocument.Parse(result);

ResultXML 看起来像

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <FaxResponse xmlns="http://abc.xyz/">
      <FaxResult>5421266115</FaxResult>
    </FaxResponse>
  </soap:Body>
</soap:Envelope>

我需要FaxResult,我该如何阅读?

【问题讨论】:

    标签: asp.net xml linq soap


    【解决方案1】:

    试试这个:

    var doc=new XmlDocument();
    doc.Load("path\\Sample.xml");
    var k = doc.GetElementsByTagName("FaxResult")[0].InnerText;
    

    【讨论】:

    • 感谢编辑。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-23
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多