I have a DE call 'RESULTDE_2' where i receive a XML like this

    <?xml version='1.0' encoding='UTF-8'?>
<request xmlns="http:/service_request"> <queryAttributes> 
        <queryAttribute indexName="ID_KEY" Value="RAMDOM">
    <requestor />


I trying to get this data (XML) and print on the screen just to test an API CALL trough SSJS with this:

var XML = Platform.Function.Lookup('RESULTDE_2','XML ','STATUS','Waiting');

no text display on the screen, but the DE exists 1 record with this Status and a XML in TEXT FIELD (and only this record in DE)


1 Answer 1


If you are just looking at displaying the XML, you have to realize that currently what is likely happening is that the HTML parser that is reading the response you send when loading the page in your browser is recognizing the XML as actual tags and trying to visually display them instead of just showing the code. (you can test this by doing an 'inspect element on where the XML should be and viewing the code or doing a 'view source')

What you will want to do to just show the code in the page is utilize a replace() to turn the < and > into html entities so the parser no longer views it as code, but instead the string you want it to be.

Something like:

var XML = Platform.Function.Lookup('RESULTDE_2','XML ','STATUS','Waiting');

Now as @JonasLamberty said, SSJS is definitely not the way to go with parsing out the XML, so I would look to utilize the AMPscript BuildRowsetFromXML() instead to work with your XML. There are some ways through RegEx like he stated, but I find it to be clunky and harder to maintain and troubleshoot.

  • Hi @Gortonington, i'm trying use SSJS cause my goal is use this XML to use in a HTTPOST through Automation Studio.. This XML i will pass in base64 encode and call an api for return a response in the same DE
    – João
    Dec 15, 2021 at 19:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .