Parse
Convert an XML string to an object. By converting XML to an object, you can leverage many of the built in functions such as those in the List and Object function categories to process and utilize values from the XML string throughout the rest of your flow.
Input
Field | Definition | Type | Required |
---|---|---|---|
xml | XML string to be converted into an object. | String | TRUE |
options | |||
attrkey | string used as the key for the attribute object created for each XML element; default is $. | String | TRUE |
charkey |
String used as the key to access character content within an XML element. This only applies if explicitCharkey is True. In the example below, this changes the output to the following for an element: |
String | FALSE |
explicitCharkey |
Indicates if charkey is used; default is False. If set to False, output will look like the example below; if set to True, output will look like the snippet above. |
Boolean | FALSE |
trim |
Indicates if the whitespace at the beginning and end of a text node should be removed; default is False. If set to True, the content |
Boolean | FALSE |
normalizeTags |
Indicates if all tag names should be normalized to lowercase; default is False. If set to True, ' |
Boolean | FALSE |
normalize |
Indicates if whitespace within a text node should be trimmed; default is False. |
Boolean | FALSE |
explicitRoot |
Indicates if the root node should be included in the resulting object; default is False. If set to True, the output in the example below would be wrapped within a catalog object. |
Boolean | FALSE |
Output
Field | Definition | Type |
---|---|---|
output | Object constructed based on the input XML and selected options. | Object |
Example (XML Input)
<?xml version="1.0"?>
<catalog>
<release id="JNR165.8">
<artist>Surfer Blood</artist>
<title>1000 Palms</title>
<genre>Rock</genre>
<label>Joyful Noise Recordings</label>
<release_date>2015-05-12</release_date>
</release>
<release id="OLE 984-7">
<artist>The Men</artist>
<title>Singles Going Home Alone #3</title>
<genre>Rock</genre>
<label>Matador Records</label>
<release_date>2012-03-01</release_date>
</release>
<release id="SC007">
<artist>Michael Nau</artist>
<title> Love Survive</title>
<genre>Rock</genre>
<label>Singles Club</label>
<release_date>2015-09-01</release_date>
</release>
<release id="DEG001">
<artist>Coastal</artist>
<title>Winter</title>
<genre>Rock</genre>
<label>Dream by Degrees</label>
<release_date>2002-01-01</release_date>
</release>
</catalog>
Example (Object Output based on default selections)
{
“release": [
{
"$": { "id": "JNR165.8" },
"artist": [ "Surfer Blood" ],
"title": [ "1000 Palms" ],
"genre": [ "Rock" ], "label": [ "Joyful Noise Recordings" ],
“release_date": [ "2015-05-12" ]
},
{
"$": { "id": "OLE 984 - 7" },
"artist":[ "The Men" ],
"title": [ "Singles Going Home Alone #3" ],
"genre": [ "Rock" ],
"label": [ "Matador Records" ],
"release_date": [ "2012-03-01" ]
},
{
"$": { "id": "SC007" },
"artist":["Michael Nau" ],
"title": [ "Love Survive" ],
"genre": [ "Rock" ],
"label": [ "Singles Club" ],
"release_date": [ "2015-09-01" ]
},
{
"$": { "id": "DEG001" },
"artist":["Coastal" ],
"title": [ "Winter" ],
"genre": [ "Rock" ],
"label": [ "Rock" ],
"release_date": [ "2002-01-01" ]
}
]
}