XML Parse Tool
The XML parse tool reads in a chunk of Extensible Markup Language (XML) and parses it into individual fields.
Namespaces in Designer
In versions prior to 9.0, the use of namespaces was "undefined." Namespaces are no longer supported in Designer 9.0. If the XML contains namespaces (e.g. "w:document") the namespace are stripped off in the output (e.g. "document" is returned).
Please see Reading XML for more information about how Alteryx reads and parses XML.
Configure the Tool
- Select the Field with XML Data you would like to parse by selecting from the string fields included in your input.
- Use Include in Output (checked by default) to determine whether or not to pass the parsed field downstream when the workflow runs.
- Select the XML Element to Parse. Options include...
- The Root element.
- Auto Detect Child: Parse out the element that is a child to the element in the input data. This is an alternative to specifying which element of the XML to parse. If an element occurs the highest number of times under a single parent node, this is the element that is chosen to be parsed.
- Specific Child Name: Enter the name of the child element to be parsed out. The XML element is case-sensitive.
- Return Child Values: When checked, the first set of child values are returned. When unchecked, child values are left out.
- Return Outer XML: When checked, the outer XML tags are returned. An additional field for each parsed field is created with the suffix _OuterXML and the tags are included around the values in the data table.
- Ignore XML Errors and Continue: Ignore any errors that are produced by the XML and continue parsing.
How Auto Detect Child Works
If an element occurs the highest number of times under a single parent node, this is the chosen element. If no element occurs more than once, then the default is simply to select the 1st child of the root.
Example
In the code example...
- The
record
element is auto-detected because it occurs 3 times under the 1 parent. - The
root
andfirstchild
elements each appear once. - The
field1
,field2
, andfield3
elements appear 3 times each, but not under a single parent node (they each occur once per parent "record" node.)
Important
The Auto Detect Child only takes the 1st row of input into account versus all rows of input. The messages tab on the output of the XML Parse tool should show a message that indicates which element was auto-detected as the default.