0
我在一個文件中的以下XML稱爲response2.xml的VBScript SelectionNamespaces的selectSingleNode錯誤運行時錯誤:所需的對象:
<?xml version="1.0"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body><ns2:commonServiceResponse xmlns:ns2="http://webservice.mas.gepics.ab.com">
<return>
<responseData><?xml version="1.0" encoding="utf-8"?>
<tnsa:GetABQData xmlns:tns="http://www.ab.com/ns/ABQ/ABQSchemaExtensions"
xmlns:tnsa="http://www.ab.com/ns/ABQ/ABQMessageStandard" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ab.com/ns/ABQ/ABQMessageStandard ABQSchemaHeaders.xsd"
releaseID="string" versionID="string">
<tnsa:ApplicationArea>
<tnsa:CreationDateTime>2012-04-03T08:53:20</tnsa:CreationDateTime>
<tnsa:ABQHeader>
<tnsa:VehicleAssemblyPlant>CHW</tnsa:VehicleAssemblyPlant>
<tnsa:Source>GEPICS</tnsa:Source>
<tnsa:Destination>SEP</tnsa:Destination>
<tnsa:TransactionCode>
<tnsa:Transaction>TACK</tnsa:Transaction>
</tnsa:TransactionCode>
<tnsa:TriggerID>0</tnsa:TriggerID>
<tnsa:InputDevice>MAS01</tnsa:InputDevice>
<tnsa:OutputDevice>MASOUT01</tnsa:OutputDevice>
</tnsa:ABQHeader>
</tnsa:ApplicationArea>
<tnsa:DataArea>
<tnsa:Get>
<tnsa:Expression>string</tnsa:Expression>
</tnsa:Get>
<tnsa:ABQData releaseID="string">
<tnsa:ABQSpecific>
<tnsa:Vehicle>
<tns:GEPICSTrgPrimaryKey>101718664</tns:GEPICSTrgPrimaryKey>
<tns:GEPICSTrgSecondaryKey> </tns:GEPICSTrgSecondaryKey>
</tnsa:Vehicle>
<tns:BroadCastData>
<tns:DataTagID>231</tns:DataTagID>
<tns:DataLength>34</tns:DataLength>
<tns:DataString>ADDORDER1017186643G1SE51X3AS118601</tns:DataString>
</tns:BroadCastData>
</tnsa:ABQSpecific>
</tnsa:ABQData>
</tnsa:DataArea>
</tnsa:GetABQData>
</responseData>
<success>true</success>
</return>
</ns2:commonServiceResponse>
</S:Body>
</S:Envelope>
我有以下的VBScript叫5.vbs從文件中讀取一個節點
Set oXMLDoc = CreateObject("MSXML2.DOMDocument.4.0")
oXMLDoc.async = False
oXMLDoc.load ("response2.xml")
oXMLDoc.setProperty "SelectionLanguage", "XPath"
oXMLDoc.setProperty "SelectionNamespaces", "xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns2='http://webservice.mas.gepics.ab.com' xmlns:tnsa='http://www.ab.com/ns/ABQ/ABQMessageStandard'"
WScript.Echo oXMLDoc.selectSingleNode("//S:Envelope//S:Body//ns2:commonServiceResponse//return//responseData").text
我執行命令CSCRIPT 5.vbs,我得到以下錯誤 運行時錯誤:所需的對象: 'oXMLDoc.selectSingleNode(...)'
無論我做什麼,我都無法在tnsa中選擇任何節點:GetABQData樹。
任何建議 預先感謝