XML Decoder Processor¶
The “XML Decoder Processor” is installed with the Dataristix Application. The processor accepts any input values and decodes the incoming XML document to extract tag values.
Add to Task¶
Add the “XML Decoder” to a task by dragging it from the “Build” panel onto the task’s “Task Builder” panel.
Configuration¶
Select the “XML Decoder Processor” item in the “Task Builder” panel to view its properties.
You can change the following properties:
- Name
- The title of the “XML Decoder Processor” as it appears within the task builder.
- XPath to Tag Nodes
- The XPath to pre-select XML nodes from where tag values should be extracted (see examples below). If the XPath is left blank, then the entire XML document input is pre-selected.
- Property Name / XPath pairs
- A list of property name and XPath pairs separated by comma, one pair per line. The property name determines the name of the output tag of the XML Decoder task node. The XPath determines how to extract a value for the property from the XML nodes pre-selected by “XPath to Tag Nodes” (see examples below).
Press the “Apply” button to commit your changes.
Example 1¶
The following example shows a task that receives a simple XML document containing a single value. The document is:
<values>
<value>1234</value>
</values>
To extract the value, the XML Decoder is configured as follows:
The “XPath to Tag Nodes” is set to values
. This will pre-select the content of the “values”
XML node for property extraction. The property name and XPath pairs are set to value,value
which means
that the output tag name of the XML Decoder should be “value” (any other name will work as well) and the
value for that property should be extracted via XPath “value” applied to the preselected content of the
“values” XML node.
The XML Decoder extracts the value from the document and makes it available for further processing.
Example 2¶
In this example, we want to extract multiple values from an XML document. The document is:
<values>
<value>1</value>
<value>2</value>
<value>3</value>
</values>
To extract the (multiple) values, the XML Decoder is configured as follows:
The “XPath to Tag Nodes” is set to values/value
. This will pre-select an array of “value” XML nodes.
The property name and XPath pairs are left blank, which means that the output is an array of strings containing
each “value” XML node.
The image above shows the input XML document (1) that is sent to the XML Decoder (2). The output terminator (3) shows the output of the XML Decoder, consisting of an array of strings “<value>1</value>”, “<value>2</value>” and “<value>3</value>” which can than be used for further processing. In the example, the string array is sent to an Array Sequencer Processor (3) from where each individual element is sent to the final output stage (5).
Adding additional XML Decoders here would allow extracting each individual value. To extract the value from an XML document in the form
<value>1</value>
use an empty “XPath to Tag Nodes” and a property name and XPath pair value,.
to extract the current node content.