XML Processor
The XML Processor action is one of the actions at your disposal to work with XML data.
XML Processor enables you to create an XML file starting from an XML template. The action will be able to add data to an XML input using an XPath expression.
Use XML Processor action to build or update an XML node by node by processing an input list of objects that encapsulate the xpath, tag name, value and attribute of a XML node.
Additionally, one can configure a set of namespaces that can be used to prefix certain tags. This is optional but can be configured in the second input by passing an object having the prefix-namespace association as key-value pairs. If not applicable, then leave an empty object: {}. The last input is the base XML from which the processing starts. Any addition or update will be done based on this XML. It can be any valid XML however simple or complex.
๏ปฟ
The action is used to create an XML structure that we will import into our process for future use.
- Input JSON - Input your the data (Xpaths & Tags in JSON array structure, but as a String) that you need to add in the XML template
Input JSON must be a list of objects, each object having the following 3 properties:
"xpath" (the absolute position)
"xmlTag" (xml tag to be introduced)
"newValue"
- Input prefix - if applicable
- Input template xml - add the XML template (as a string)
- Result - returns the new XML as a string
----------------------------------------------------------------------------------------------------------
We will start creating an XML structure starting from the template below:
This is the XML structure we want to create from the template:
How to configure the XML Processor action?๏ปฟ๏ปฟ
1. Create a process and give it a name.
2. Drag the XML processor action to the canvas and link it to the other actions.

3. Create the variables needed for the configuration of the action, and then add them to the configuration panel:

The inputXML variable already has assigned a default value which is the template of our XML:
<Invoice></Invoice>
4. Add the String with the data structure (as a Json array) that will create the XML structure.
5. Add prefix - if applicable.
In case the XML Process error fails with the error Value cannot be null. (Parameter 's') you may consider adding a prefix, with the following syntax: key="value'
Else, if not applicable, leave an empty object: {}.
6. Add the input template
7. Add the variable that stores the string result

8. Save, Validate, Run
9. Click Check Instance to view the results. You will see the new XML string generated in the output variable, resultXml:

If we copy the resulting string and paste it into an XML-friendly tool to format it, we will have the result we aimed for from the beginning:
๏ปฟ