我有一个正在尝试解析的 msxml 文档。
这是 xml -
xmlDoc.responseDocument:
<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>
<Response xmlns="http://company.com/Services">
<Result>test</Result>
</Response>
</soap:Body>
</soap:Envelope>
xmlDoc.selectSingleNode("soap:Body") 返回“对未声明的命名空间前缀的引用:'soap'。”
感谢您提供的任何帮助。
最佳答案
对于任何感兴趣的人,这对我有用 -
var soapNS = 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"';
xmlDoc.documentElement.setProperty("SelectionNamespaces", soapNS);
xmlDoc.document.selectSingleNode("soap:Body");
关于javascript - 引用未声明的命名空间前缀 : 'soap' when parsing MSXML soap response using selectSingleNode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25316939/