Hey folks,
how can I parse the XML from a "theHTTP.getServerResponse()"-string.
Looks like this. So need to enter the "key" element. "<apiKey succeeded="true" key="MYNEWAPIKEY" validTill="2021-07-27 03:56:15Z" superAdmin="false" />"
Is there no parse function like there is one for JSON.parse() ?
How to parse XML Response from Chili Publish API in Switch Legacy Scripter
Re: How to parse XML Response from Chili Publish API in Switch Legacy Scripter
There is not. You have to place the output in a temporary file and then load that:
Two questions:
Code: Select all
var response = new ByteArray( "it is a ByteArray when coming in as an HTTP response");
var tempPath = job.createPathWithName( "response.xml");
File.writeByteArray( tempPath, response);
var xml = new Document( tempPath);
//now xml is an instance of Document
- Why are not you using the Chili Publish configurators?
- Why do you do this in legacy scripting?
Re: How to parse XML Response from Chili Publish API in Switch Legacy Scripter
I tried this with the Chili Publish Flow Element and action documentCreatePDF.
ATM it's not working. Chili Support works on this ticket.
We haven't updated switch. Because it's risky and we ain't got the time and capacity to fix everything of those old flows.
Thanks Freddy.
I will use a Nodejs server from Heroku and parse XML with fast-xml-parser library.
ATM it's not working. Chili Support works on this ticket.
We haven't updated switch. Because it's risky and we ain't got the time and capacity to fix everything of those old flows.
Thanks Freddy.
I will use a Nodejs server from Heroku and parse XML with fast-xml-parser library.
Benjamin