我怎么知道节点是否存在

时间:2011-06-01 14:07:41

标签: xml asp-classic

这是我得到的响应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具有此节点的两种情况都是如此,即使它没有它

我做错了什么?

1 个答案:

答案 0 :(得分:0)

分两步完成

Set faultCodeNode = myXML.selectSingleNode("faultcode")

If faultCodeNode Is Nothing Then