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













1















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>









share|improve this question




























    1















    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>









    share|improve this question


























      1












      1








      1








      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>









      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 7 at 11:31









      QHarr

      36.2k82144




      36.2k82144










      asked Mar 7 at 10:16









      Tomáš JalčTomáš Jalč

      103




      103






















          1 Answer
          1






          active

          oldest

          votes


















          1














          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





          share|improve this answer























          • 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










          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
          );



          );













          draft saved

          draft discarded


















          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









          1














          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





          share|improve this answer























          • 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















          1














          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





          share|improve this answer























          • 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













          1












          1








          1







          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





          share|improve this answer













          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






          share|improve this answer












          share|improve this answer



          share|improve this answer










          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

















          • 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



















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

          Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

          Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved