使用XPATH读取 DOMDocument 节点内容
XML文件内容是这样的
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body><RegisterPersonMemberResponse xmlns="http://www.fztnet.com.cn/RegisterService">
<RegisterPersonMemberResult><IsSuccessful>true</IsSuccessful><Status>0</Status>
</RegisterPersonMemberResult></RegisterPersonMemberResponse>
</soap:Body></soap:Envelope>
我使用这个XPATH表达式来求Status的值。/Envelope/Body/RegisterPersonMemberResponse/RegisterPersonMemberResult/Status
但会出错。得到的空结点。
不知为什么。。谢谢
xmlDoc.setProperty("SelectionLanguage", "XPath");
var path = "/Envelope/Body/RegisterPersonMemberResponse/RegisterPersonMemberResult/Status";
var node = xmlDoc.selectSingleNode(path);