Parse XML SOAP document using VBAPossible to consume badly formed Fault Messages?What characters do I need to escape in XML documents?How do I parse XML in Python?How Do You Parse and Process HTML/XML in PHP?How to pass “Null” (a real surname!) to a SOAP web service in ActionScript 3?.NET (C#) and RAW Soap TransactionsRead SOAP XML by ASMX web servcie functionSOAP vs REST (differences)SOAP response/Request then how to convert it in to PHPRemove xmlns from XML using XSLT
Are taller landing gear bad for aircraft, particulary large airliners?
Resetting two CD4017 counters simultaneously, only one resets
Hostile work environment after whistle-blowing on coworker and our boss. What do I do?
Invariance of results when scaling explanatory variables in logistic regression, is there a proof?
What is the term when two people sing in harmony, but they aren't singing the same notes?
Greatest common substring
Perfect riffle shuffles
Reply ‘no position’ while the job posting is still there (‘HiWi’ position in Germany)
Freedom of speech and where it applies
Science Fiction story where a man invents a machine that can help him watch history unfold
Would it be legal for a US State to ban exports of a natural resource?
Have I saved too much for retirement so far?
Why isn't KTEX's runway designation 10/28 instead of 9/27?
Latex for-and in equation
Can somebody explain Brexit in a few child-proof sentences?
What is Sitecore Managed Cloud?
I2C signal and power over long range (10meter cable)
Meta programming: Declare a new struct on the fly
Giant Toughroad SLR 2 for 200 miles in two days, will it make it?
For airliners, what prevents wing strikes on landing in bad weather?
My boss asked me to take a one-day class, then signs it up as a day off
A workplace installs custom certificates on personal devices, can this be used to decrypt HTTPS traffic?
node command while defining a coordinate in TikZ
Is there enough fresh water in the world to eradicate the drinking water crisis?
Parse XML SOAP document using VBA
Possible to consume badly formed Fault Messages?What characters do I need to escape in XML documents?How do I parse XML in Python?How Do You Parse and Process HTML/XML in PHP?How to pass “Null” (a real surname!) to a SOAP web service in ActionScript 3?.NET (C#) and RAW Soap TransactionsRead SOAP XML by ASMX web servcie functionSOAP vs REST (differences)SOAP response/Request then how to convert it in to PHPRemove xmlns from XML using XSLT
I will be grateful for any help. I need to parse XML SOAP document but always I get the same result -> plain text without tags. How Can I get particular/single tag (f.e. vatNumber) value from XML ? Thank you.
This is my VBA code:
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
This is XML SOAP input:
<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>
xml vba soap web-scraping
add a comment |
I will be grateful for any help. I need to parse XML SOAP document but always I get the same result -> plain text without tags. How Can I get particular/single tag (f.e. vatNumber) value from XML ? Thank you.
This is my VBA code:
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
This is XML SOAP input:
<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>
xml vba soap web-scraping
add a comment |
I will be grateful for any help. I need to parse XML SOAP document but always I get the same result -> plain text without tags. How Can I get particular/single tag (f.e. vatNumber) value from XML ? Thank you.
This is my VBA code:
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
This is XML SOAP input:
<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>
xml vba soap web-scraping
I will be grateful for any help. I need to parse XML SOAP document but always I get the same result -> plain text without tags. How Can I get particular/single tag (f.e. vatNumber) value from XML ? Thank you.
This is my VBA code:
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
This is XML SOAP input:
<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>
xml vba soap web-scraping
xml vba soap web-scraping
edited Mar 7 at 11:31
QHarr
36.2k82144
36.2k82144
asked Mar 7 at 10:16
Tomáš JalčTomáš Jalč
103
103
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Either remove the offending namespace from the xpath search
Set node = xmlDoc.SelectSingleNode("//*[local-name()='vatNumber']")
Debug.Print node.Text
Or remove that second xmlns from the response then parse (you could regex replace for example)
Dim node As IXMLDOMElement
Set node = xmlDoc.SelectSingleNode("//vatNumber")
Debug.Print node.Text
Yes, thank you. First option works great ! I removed namespace and xmlns (whole row) and it works.
– Tomáš Jalč
Mar 7 at 12:10
No worries. Please remember to consider hitting accept check mark next to answer. stackoverflow.com/help/someone-answers
– QHarr
Mar 7 at 13:01
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55041261%2fparse-xml-soap-document-using-vba%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Either remove the offending namespace from the xpath search
Set node = xmlDoc.SelectSingleNode("//*[local-name()='vatNumber']")
Debug.Print node.Text
Or remove that second xmlns from the response then parse (you could regex replace for example)
Dim node As IXMLDOMElement
Set node = xmlDoc.SelectSingleNode("//vatNumber")
Debug.Print node.Text
Yes, thank you. First option works great ! I removed namespace and xmlns (whole row) and it works.
– Tomáš Jalč
Mar 7 at 12:10
No worries. Please remember to consider hitting accept check mark next to answer. stackoverflow.com/help/someone-answers
– QHarr
Mar 7 at 13:01
add a comment |
Either remove the offending namespace from the xpath search
Set node = xmlDoc.SelectSingleNode("//*[local-name()='vatNumber']")
Debug.Print node.Text
Or remove that second xmlns from the response then parse (you could regex replace for example)
Dim node As IXMLDOMElement
Set node = xmlDoc.SelectSingleNode("//vatNumber")
Debug.Print node.Text
Yes, thank you. First option works great ! I removed namespace and xmlns (whole row) and it works.
– Tomáš Jalč
Mar 7 at 12:10
No worries. Please remember to consider hitting accept check mark next to answer. stackoverflow.com/help/someone-answers
– QHarr
Mar 7 at 13:01
add a comment |
Either remove the offending namespace from the xpath search
Set node = xmlDoc.SelectSingleNode("//*[local-name()='vatNumber']")
Debug.Print node.Text
Or remove that second xmlns from the response then parse (you could regex replace for example)
Dim node As IXMLDOMElement
Set node = xmlDoc.SelectSingleNode("//vatNumber")
Debug.Print node.Text
Either remove the offending namespace from the xpath search
Set node = xmlDoc.SelectSingleNode("//*[local-name()='vatNumber']")
Debug.Print node.Text
Or remove that second xmlns from the response then parse (you could regex replace for example)
Dim node As IXMLDOMElement
Set node = xmlDoc.SelectSingleNode("//vatNumber")
Debug.Print node.Text
answered Mar 7 at 11:24
QHarrQHarr
36.2k82144
36.2k82144
Yes, thank you. First option works great ! I removed namespace and xmlns (whole row) and it works.
– Tomáš Jalč
Mar 7 at 12:10
No worries. Please remember to consider hitting accept check mark next to answer. stackoverflow.com/help/someone-answers
– QHarr
Mar 7 at 13:01
add a comment |
Yes, thank you. First option works great ! I removed namespace and xmlns (whole row) and it works.
– Tomáš Jalč
Mar 7 at 12:10
No worries. Please remember to consider hitting accept check mark next to answer. stackoverflow.com/help/someone-answers
– QHarr
Mar 7 at 13:01
Yes, thank you. First option works great ! I removed namespace and xmlns (whole row) and it works.
– Tomáš Jalč
Mar 7 at 12:10
Yes, thank you. First option works great ! I removed namespace and xmlns (whole row) and it works.
– Tomáš Jalč
Mar 7 at 12:10
No worries. Please remember to consider hitting accept check mark next to answer. stackoverflow.com/help/someone-answers
– QHarr
Mar 7 at 13:01
No worries. Please remember to consider hitting accept check mark next to answer. stackoverflow.com/help/someone-answers
– QHarr
Mar 7 at 13:01
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55041261%2fparse-xml-soap-document-using-vba%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown