OL Learn

Parsing XML within Workflow

Hi

I have a job where I have a XML index file as per the below:

image

I am extracting most of the info and adding to local variables using a SetJobInfos and then passing into a data mapper which is reading in the PDF and adding the info from the XML as metadata. However I’m not sure how to get the values in parameters? So for example I would want to assign the value for DISTRIBUTION to a local variable called Postage.

James

To obtain the value of the value attribute for a specific name value, you’ll have to use a script similar to this:

var myXML = new ActiveXObject("msxml2.DomDocument");
myXML.load(Watch.GetJobFileName());
var myElement = myXML.selectSingleNode('//parameters/parameter[@name="DISTRIBUTION"]');
Watch.SetVariable("Postage",myElement.getAttribute("value"));