Reading XML

Version:
Current
Last modified: April 02, 2020

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

XML example

XML
  1. <items>
  2. 	<item id="01" type="Donut">
  3. 		<name>Cake</name>
  4. 		<ppu>0.60</ppu>
  5. 		<batters>
  6. 			<batter id="10">Regular</batter>
  7. 			<batter id="11">Chocolate</batter>
  8. 			<batter id="12">Blueberry</batter>
  9. 			<batter id="13">Devil's Food</batter>
  10. 		</batters>
  11. 		<topping>
  12. 			<topping id="100">None</topping>
  13. 			<topping id="101">Glazed</topping>
  14. 			<topping id="102">Sugar</topping>
  15. 			<topping id="103">Powdered Sugar</topping>
  16. 			<topping id="104">Chocolate</topping>
  17. 			<topping id="105">Chocolate with Sprinkles</topping>
  18. 			<topping id="106">Maple</topping>
  19. 		</topping>
  20. 	</item>
  21. 	<item id="02" type="Donut">
  22. 		<name>Raised</name>
  23. 		<ppu>0.65</ppu>
  24. 		<batters>
  25. 			<batter id="10">Regular</batter>
  26. 		</batters>
  27. 		<topping>
  28. 			<topping id="100">None</topping>
  29. 			<topping id="101">Glazed</topping>
  30. 			<topping id="102">Sugar</topping>
  31. 			<topping id="104">Chocolate</topping>
  32. 			<topping id="106">Maple</topping>
  33. 		</topping>
  34. 	</item>
  35. 	<item id="03" type="Donut">
  36. 		<name>Buttermilk</name>
  37. 		<ppu>0.50</ppu>
  38. 		<batters>
  39. 			<batter id="10">Regular</batter>
  40. 			<batter id="11">Chocolate</batter>
  41. 		</batters>
  42. 	</item>
  43. </items>

Default settings

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:

  • do not contain the root element.
  • contain the child elements of the root element.
  • contain the grandchild elements of the root element.
  • do not contain the child elements of a specified element.
  • do not contain tag formatting.

Child element name

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:

  • do not contain the root element.
  • do not contain the child elements of the root element.
  • do not contain the grandchild elements of the root element.
  • contain the child elements of a specified element.
  • do not contain tag formatting.

The remaining sections detail the impact on returned results when changing configuration selections from the default options.

Return root element

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:

  • contain the root element.
  • contain the child elements of the root element.
  • do not contain the grandchild elements of the root element.
  • do not contain the child elements of a specified element.
  • do not contain tag formatting.

Child element name

Specifying an XML Child Element Name does not change the results. Alteryx prioritizes reading the root element.

Return child values

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:

  • do not contain the root element.
  • contain the child elements of the root element.
  • do not contain the grandchild elements of the root element.
  • do not contain the child elements of a specified element.
  • do not contain tag formatting.

Child element name

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 results:

  • o not contain the root element.
  • do not contain the child elements of the root element.
  • do not contain the grandchild elements of the root element.
  • do not contain the child elements of a specified element.
  • do not contain tag formatting.

Return outer XML

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:

  • do not contain the root element.
  • do not contain the child elements of the root element.
  • do not contain the grandchild elements of the root element.
  • do not contain the child elements of a specified element.
  • contain tag formatting.

Child element name

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:

  • do not contain the root element.
  • do not contain the child elements of the root element.
  • do not contain the grandchild elements of the root element.
  • contain the child elements of a specified element.
  • contain tag formatting.
Was This Helpful?

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