Alteryx can read and parse XML through either the Input Data Tool or the XML Parse Tool. These examples focus on the Input Data tool configuration options.
All descriptions reference the example below.
<items>
<item id="01" type="Donut">
<name>Cake</name>
<ppu>0.60</ppu>
<batters>
<batter id="10">Regular</batter>
<batter id="11">Chocolate</batter>
<batter id="12">Blueberry</batter>
<batter id="13">Devil's Food</batter>
</batters>
<topping>
<topping id="100">None</topping>
<topping id="101">Glazed</topping>
<topping id="102">Sugar</topping>
<topping id="103">Powdered Sugar</topping>
<topping id="104">Chocolate</topping>
<topping id="105">Chocolate with Sprinkles</topping>
<topping id="106">Maple</topping>
</topping>
</item>
<item id="02" type="Donut">
<name>Raised</name>
<ppu>0.65</ppu>
<batters>
<batter id="10">Regular</batter>
</batters>
<topping>
<topping id="100">None</topping>
<topping id="101">Glazed</topping>
<topping id="102">Sugar</topping>
<topping id="104">Chocolate</topping>
<topping id="106">Maple</topping>
</topping>
</item>
<item id="03" type="Donut">
<name>Buttermilk</name>
<ppu>0.50</ppu>
<batters>
<batter id="10">Regular</batter>
<batter id="11">Chocolate</batter>
</batters>
</item>
</items>
The Input Data tool uses these default XML settings:
Configuration option | Setting |
---|---|
Return Root Element | Deselected |
XML Child Element Name | Unspecified |
Return Child Values | Selected |
Return Outer XML | Deselected |
These settings applied to the example XML input generate the following results:
item | id | type | name | ppu | batters | topping |
---|---|---|---|---|---|---|
01 | Donut | Cake | 0.60 | |||
02 | Donut | Raised | 0.65 | |||
03 | Donut | Buttermilk | 0.50 | [Null] |
These results:
Specifying an XML Child Element Name causes Alteryx to read the file from the element.
Configuration option | Setting |
---|---|
Return Root Element | Deselected |
XML Child Element Name | "topping" |
Return Child Values | Selected |
Return Outer XML | Deselected |
These settings applied to the example XML input generate the following results:
topping | topping_1 | topping_1_id | topping_2 | topping_2_id | topping_3 | topping_3_id |
---|---|---|---|---|---|---|
None | 100 | Glazed | 101 | Sugar | 102 | |
None | 100 | Glazed | 101 | Sugar | 102 | |
Chocolate | 104 | Maple | 106 | |||
Glazed | 101 | Sugar | 102 | |||
Glazed | 101 | Powdered Sugar | 103 | Chocolate | 104 |
These results:
The remaining sections detail the impact on returned results when changing configuration selections from the default options.
Select Return Root Element to return the parent element that encloses all other represented elements.
Configuration option | Setting |
---|---|
Return Root Element | Selected |
XML Child Element Name | Unspecified |
Return Child Values | Selected |
Return Outer XML | Deselected |
These settings applied to the example XML input generate the following results:
items | item | item_id | item_type | item_2 | item_2_id | item_2_type | item_3 | item_3_id | item_3_type |
---|---|---|---|---|---|---|---|---|---|
01 | Donut | 02 | Donut | 03 | Donut |
These results:
Specifying an XML Child Element Name does not change the results. Alteryx prioritizes reading the root element.
Deselect Return Child Values to return only the child values of the root element.
Configuration option | Setting |
---|---|
Return Root Element | Deselected |
XML Child Element Name | Unspecified |
Return Child Values | Deselected |
Return Outer XML | Deselected |
These settings applied to the example XML input generate the following results:
item | id | type |
---|---|---|
01 | Donut | |
02 | Donut | |
03 | Donut |
These results:
Specifying an XML Child Element Name causes Alteryx to read the file from the specified element.
Configuration option | Setting |
---|---|
Return Root Element | Deselected |
XML Child Element Name | "topping" |
Return Child Values | Deselected |
Return Outer XML | Deselected |
These settings applied to the example XML input generate the following results:
topping |
---|
These results:
Select Return Outer XML to create additional columns containing the tag format of the child elements.
Configuration option | Setting |
---|---|
Return Root Element | Deselected |
XML Child Element Name | Unspecified |
Return Child Values | Selected |
Return Outer XML | Selected |
These settings applied to the example XML input generate the following results:
item | id | type | name | name_OuterXML | ppu | ppu_OuterXML | batters | batters_OuterXML | topping | topping_OuterXML | item_OuterXML |
---|---|---|---|---|---|---|---|---|---|---|---|
01 | Donut | Cake | <name>Cake</name> | 0.60 | <ppu>0.60</ppu> | <batters> | <topping> | <item id="01" type="Donut"> | |||
02 | Donut | Raised | <name>Raised</name> | 0.65 | <ppu>0.65</ppu> | <batters> | <topping> | <item id="02" type="Donut"> | |||
03 | Donut | Buttermilk | <name>Buttermilk</name> | 0.50 | <ppu>0.50</ppu> | <batters> | [Null] | [Null] | <item id="03" type="Donut"> |
These results:
Specifying an XML Child Element Name causes Alteryx to read the file from the specified element.
Configuration option | Setting |
---|---|
Return Root Element | Deselected |
XML Child Element Name | "topping" |
Return Child Values | Selected |
Return Outer XML | Selected |
These settings applied to the example XML input generate the following results:
topping | topping_1 | topping_1_id | topping_1_OuterXML | topping_2 | topping_2_id | topping_2_OuterXML | topping_3 | topping_3_id | topping_3_OuterXML |
---|---|---|---|---|---|---|---|---|---|
None | 100 | <topping id="100">None</topping> | Glazed | 101 | <topping id="101">Glazed</topping> | Sugar | 102 | <topping id="102">Sugar</topping> | |
None | 100 | <topping id="100">None</topping> | Glazed | 101 | <topping id="101">Glazed</topping> | Sugar | 102 | <topping id="102">Sugar</topping> | |
Chocolate | 104 | <topping id="104">Chocolate</topping> | Maple | 106 | <topping id="106">Maple</topping> | [Null] | [Null] | [Null] | |
Glazed | 101 | <topping id="101">Glazed</topping> | Sugar | 102 | <topping id="102">Sugar</topping> | [Null] | [Null] | [Null] | |
Glazed | 101 | <topping id="101">Glazed</topping> | Powdered Sugar | 103 | <topping id="103">Powdered Sugar</topping> | Chocolate | 104 | <topping id="104">Chocolate</topping> |
These results:
©2018 Alteryx, Inc., all rights reserved. Allocate®, Alteryx®, Guzzler®, and Solocast® are registered trademarks of Alteryx, Inc.