【问题标题】:Remove SOAP Envelepoe and soap Body element from XMLDOCUMENt从 XMLDOCUMENt 中删除 SOAP Envelepoe 和 soap Body 元素
【发布时间】:2011-09-28 12:01:55
【问题描述】:

有没有简单的方法来删除

    <soap:Envelope xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
       <soap:Body>
           <input1>jsdhkfh</input1>
       </soap:Body>
    </soap:Envelope>

TO

<input1>jsdhkfh</input1>

我有需要转换的 XMLDocument 对象。

【问题讨论】:

    标签: c# web-services xmldocument


    【解决方案1】:

    直接输入,因此可能会出现一些语法错误,但至少可以让您了解。

    XMLDocument document = ...
     XmlNamespaceManager nsmgr = new XmlNamespaceManager(document.NameTable);
    nsmgr.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");
    document.loadxml(document.DocumentElement.SelectSingleNode("soap:Body",nsmgr).ChildNodes[0].OuterXml);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多