Forum Discussion

alexis733's avatar
alexis733
Occasional Contributor
8 years ago
Solved

How to get the XML response already formatted by the browser?

Hello Comunity,

I'm having a problem related to the response rendered by IE (or any browser) and I hope you can help me out:

I have this code for retrieving a response from a request executed.

response = Aliases.WebAPIResultPage.WaitAliasChild("ResponsePage").innerText

Being "ResponsePage" is an object mapped (NameMapping) with WebAPIResultPage

Actually, the response is an XML response but it comes already formatted (see the dashes to collapse and expand) by the browser:

- <SCHEDREMOTE XMLNS="HTTP://FOO.COM/WEBSERVICES/">
- <RESPONSE>
- <RESOURCE>
<FIELD RESID="733" />
<FIELD DES="JUST A FOOOOO" />
- <EQUIP>
<FIELD STR1="" />
</EQUIP>
- <RES_USER>
<FIELD RESID="891" />
<FIELD USER1="" />
</RES_USER>
- <RES_LINK>
<FIELD RESID="460" />
<FIELD ISTRUCK="0" />
</RES_LINK>
</RESOURCE>
</RESPONSE>
</SCHEDREMOTE>


My question is, is there any way to get the XML (raw) only? The thing is that i want to parse the xml using:

Set xmlDoc = Createobject("MSXML2.DOMDocument")
xmlDoc.loadXML(response)

but in this format I can't.

Thanks in advance.

  • kevin_kapell's avatar
    kevin_kapell
    8 years ago

    See if the contentText property is visible. that one might work for you.

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    innerText is the actual text value of what is rendered on screen so it's not actually the XML response.  That's why you have the extra dashes in the file.

     

    What you will need to do is search the properties of your page to see if there are any other properties that may contain the raw XML response.

    • kevin_kapell's avatar
      kevin_kapell
      Frequent Contributor

      See if the contentText property is visible. that one might work for you.

      • alexis733's avatar
        alexis733
        Occasional Contributor

        Yes, dude, indeed I will, thank you so much for your answer.

    • alexis733's avatar
      alexis733
      Occasional Contributor

      Thank you so much for your answer and how quickly you did it......