Буду благодарен за любую помощь. Мне нужно разобрать документ XML SOAP, но всегда я получаю один и тот же результат -> простой текст без тегов. Как я могу получить конкретный / один тег (например, vatNumber) значение из XML? Спасибо.
Это мой код VBA:
ObjHTTP.Open "Post", sURL, False
ObjHTTP.setRequestHeader "Content-Type", "text/xml"
ObjHTTP.send (sEnv)
'parse xml response - output
Dim responseDocument As MSXML2.DOMDocument60
Set responseDocument = New MSXML2.DOMDocument60
responseDocument.async = False
responseDocument.validateOnParse = False
responseDocument.SetProperty "SelectionNamespaces", " xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"
responseDocument.LoadXML (ObjHTTP.responseText)
If responseDocument.parseError.reason <> "" Then
MsgBox m_objDOMPeople.parseError.reason
Exit Sub
End If
MsgBox responseDocument.SelectNodes("/soap:Envelope/soap:Body")(0).Text
Set ObjHTTP = Nothing
Set xmldoc = Nothing
Это ввод XML SOAP:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<checkVatResponse xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
<countryCode>SK</countryCode>
<vatNumber>204566287588</vatNumber>
<requestDate>2015-04-07+01:00</requestDate>
<valid>true</valid>
<name>Company k. s.</name>
<address>Some Address</address>
</checkVatResponse>
</soap:Body>
</soap:Envelope>