我如何知道节点是否存在



这是我得到的响应xml:

<?xml version="1.0" ?> 
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:ws.paymentech.net/PaymentechGateway">
- <SOAP-ENV:Body id="_0">
- <SOAP-ENV:Fault>
  <faultcode>SOAP-ENV:Server</faultcode> 
  <faultstring>521 Error. The Orbital Gateway has received a badly formatted message. Field [Card Number] exceeded max length of [19]</faultstring> 
  </SOAP-ENV:Fault>
  </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

我是这样得到的:

Response.write oXmlHTTP.responseXML.xml

我试过

if myXML.selectSingleNode("faultcode") Is Nothing then
if not isObject(myXML.selectSingleNode("faultcode")) then

在xml有这个节点的两种情况下都是正确的,即使它没有

我做错了什么?

分两步完成

Set faultCodeNode = myXML.selectSingleNode("faultcode")
If faultCodeNode Is Nothing Then

最新更新