Skip to main content

Reading XML

Alteryx 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

    <items>
	<item id="01" type="Donut">
		<name>Cake</name>
		<ppu>0.60</ppu>
		<batters>
			<batter id="10">正则</batter>
			<batter id="11">巧克力</batter>
			<batter id="12">蓝莓</batter>
			<batter id="13">恶魔蛋糕</batter>
		</batters>
		<topping>
			<topping id="100">none</topping>
			<topping id="101">糖釉</topping>
			<topping id="102">糖</topping>
			<topping id="103">糖粉</topping>
			<topping id="104">巧克力</topping>
			<topping id="105">巧克力糖屑</topping>
			<topping id="106">枫糖</topping>
		</topping>
	</item>
	<item id="02" type="Donut">
		<name>提糖</name>
		<ppu>0.65</ppu>
		<batters>
			<batter id="10">正则</batter>
		</batters>
		<topping>
			<topping id="100">none</topping>
			<topping id="101">糖釉</topping>
			<topping id="102">糖</topping>
			<topping id="104">巧克力</topping>
			<topping id="106">枫糖</topping>
		</topping>
	</item>
	<item id="03" type="Donut">
		<name>酪乳</name>
		<ppu>0.50</ppu>
		<batters>
			<batter id="10">正则</batter>
			<batter id="11">巧克力</batter>
		</batters>
	</item>
</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, when applied to the example XML input, generate these results:

  • Don't contain the root element.

  • Contain the child elements of the root element.

  • Contain the grandchild elements of the root element.

  • Don't contain the child elements of a specified element.

  • Don't 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, when applied to the example XML input, generate these 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...

  • Don't contain the root element.

  • Don't contain the child elements of the root element.

  • Don't contain the grandchild elements of the root element.

  • Contain the child elements of a specified element.

  • Don't 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, when applied to the example XML input, generate these results:

items

item

item_id

item_type

item_2

item_2_id

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

  • Don't contain the grandchild elements of the root element.

  • Don't contain the child elements of a specified element.

  • Don't 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, when applied to the example XML input, generate these results:

item

id

type

01

Donut

02

Donut

03

Donut

These results...

  • Don't contain the root element.

  • Contain the child elements of the root element.

  • Don't contain the grandchild elements of the root element.

  • Don't contain the child elements of a specified element.

  • Don't 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...

  • Don't contain the root element.

  • Don't contain the child elements of the root element.

  • Don't contain the grandchild elements of the root element.

  • Don't contain the child elements of a specified element.

  • Don't 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, when applied to the example XML input, generate these results:

item

id

type

name

name_OuterXML

ppu

ppu_OuterXML

batters

batters_OuterXML

01

Donut

Cake

<name>Cake</name>

0.60

<ppu>0.60</ppu>

<batters>

02

Donut

Raised

<nane>Raised</name>

0.65

<ppu>0.65</ppu>

<batters>

03

Donut

Buttermilk

<name>Buttermilk</name>

0.50

<ppu>0.50</ppu>

<batters>

These results...

  • Don't contain the root element.

  • Don't contain the child elements of the root element.

  • Don't contain the grandchild elements of the root element.

  • Don't 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, when applied to the example XML input, generate these results:

topping

topping_1

topping_1_id

topping_1_OuterXML

topping_2

topping_2_id

None

100

<topping id="100">None</topping>

Glazed

101

None

100

<topping id="100>None</topping>

Glazed

101

Chocolate

104

<topping id="104">Chocolate</topping>

Maple

106

Glazed

101

<topping id="101">Glazed</topping>

Sugar

102

Glazed

101

<topping id="101>Glazed</topping>

Powdered Sugar

103

These results...

  • Don't contain the root element.

  • Don't contain the child elements of the root element.

  • Don't contain the grandchild elements of the root element.

  • Contain the child elements of a specified element.

  • Contain tag formatting.