XML Parse Tool

XML Parse Tool

Version:
Current
Last modified: May 15, 2020

Use the XML Parse tool to parse Extensible Markup Language (XML) into individual fields. See Reading XML for more information on how Alteryx reads and parses XML.

If the XML contains namespaces such as w:document, the namespace will be stripped in the output and w:document will be returned.

Configure the Tool

  1. Select the Field with XML Data you would like to parse by selecting from the string fields included in your input.
  2. Select the XML Element to Parse. Options include...
    • The Root element.
    • The 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 is to be parsed. If an element occurs the highest number of times under a single parent node, this is the element that is chosen to be parsed.
    • The Specific Child Name: Enter the name of the child element to be parsed out. The XML element is case sensitive.
  3. Select additional options...
    • The Return Child Values: When checked, the first set of child values are returned. When unchecked, child values are left out.
    • The 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.
    • The Ignore XML Errors and Continue: Ignores 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 is simply to select the first child of the root.

Example

In the following code example, the “record” element is auto detected because it occurs 3 times under the one 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). 

XML
  1. <root>
  2.    <firstchild> 
  3.        <record><field1/><field2/><field3/></record>
  4.        <record><field1/><field2/><field3/></record>
  5.        <record><field1/><field2/><field3/></record>
  6.    </firstchild>
  7. </root>

The 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.

Was This Helpful?

Running into problems or issues with your Alteryx product? Visit the Alteryx Community or contact support.