Page 1 of 1

How to load an external xml into script

Posted: Tue Apr 26, 2016 5:38 pm
by Qpdv
Hello,

I need to create an order xml. Somewhere on the serve i have a base xml file which i would like to load, then change some values and store that xml as private data in the job.

First i tried to load the xml via XMLHttpRequest (which didn't work... obviously :D ).

Now i have xmlDoc = new Document(baseXmlPath);

but every time switch tries to load the xml is says "Invalid XML Document: C:/path/to/doc.xml" (tried all sort of slashes).

Now the question is how can do this "xmlDoc.getElementsByTagName("orderrefid")[0].childNodes[0].nodeValue = orderrefid;" in Switch?

Thanks in advance :)

Re: How to load an external xml into script

Posted: Tue Apr 26, 2016 5:44 pm
by gabrielp
Try the inject configurator. You can pick up the file (or a copy of it) and then do metadata pickup.

Re: How to load an external xml into script

Posted: Sun May 01, 2016 6:56 pm
by Caiofabio
Qpdv wrote: but every time switch tries to load the xml is says "Invalid XML Document: C:/path/to/doc.xml" (tried all sort of slashes).
In my opinion there are syntax errors in the xml file.
Also check the encoding of the XML file. Is UTF8?