XML Parse Tool
Use XML Parse to parse Extensible Markup Language (XML) into individual fields. Go to Reading XML for more information on how Alteryx reads and parses XML.
Important
If the XML contains namespaces such as w:document
, the namespace is stripped from the output and w:document
is returned.
Configure the Tool
Select the Column with XML to Parse and choose string columns from the input.
Select the XML Element to Parse:
Root
Auto Detect Child: Parse out the element that is a child to the element in the input data—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 parse.
Specify Child: Enter the name of the child element to be parsed out. The XML element is case sensitive.
Select other options:
Output Child Values: Return values 1 level below the parsed element.
Output Outer XML: Return the full element structure of the selected element. An additional column for each parsed column is created with the suffix
_OuterXML
, and the tags are included around the values in the data table.Ignore XML Errors and Continue Processing Data: Ignore any errors that are produced by the XML and continues 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 behavior is to select the first child of the root.
Tip
Example
In this example, the record element is auto-detected because it occurs 3 times under the 1 parent.
The root
and firstchild
elements each appear once.
The field1
, field2
, and field3
elements appear 3 times each, but not under a single parent node (they each occur once per parent record
node).
<root> <firstchild> <record><field1/><field2/><field3/></record> <record><field1/><field2/><field3/></record> <record><field1/><field2/><field3/></record> </firstchild> </root>
Auto-detect Child only takes the first 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 indicating which element was auto detected as the default.