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"));

How do I get the node value?

< name >address_default< /name >

var myElement = myXML.selectSingleNode('//name');
Watch.SetVariable("Name",myElement.textContent);

Thanks for the quick response, this is very helpfull

I’m getting empty value :o, do I miss something?

var soort = myXML.selectSingleNode(‘//request/values/Soort’);
Watch.SetVariable(“Soort”,soort.textContent);

Got it to work with .text instead of .textContent