Parse

Overview

This function converts an XML string to an object. By converting XML to an object, you will be able to leverage many of the built in functions such as those in the List and Object categories to process and utilize values from the XML string throughout the rest of your Flow.

Input Fields

  • xml(text): the XML string to be converted into an object

  • options

    • attrkey (text) - default is '$': The string to use as the key for the attribute object created for each XML element.

    • charkey (text) - default is '_':The string to use as the key to access character content within an XML element. This only applies if 'explicitCharkey' is 'true'. In the example included below, this would change the output to something like the following for an element: "artist": [ { "_": "Surfer Blood" } ]

    • explicitCharkey (true/false) - default is false: Designates if the 'charKey' specified above is used. If false, output will look like the example below; if true, output will look like the snippet above.

    • trim(true/false) - default is false: Designates if the whitespace at the beginning and end of a text node should be removed. If true, the content 'Surfer Blood    ' in the input XML would become 'Surfer Blood' in the output object.

    • normalizeTags(true/false) - default is false: Designates if all tag names should be normalized to lowercase. If true, '<ARTIST>' in the input XML would become 'artist' in the output object.

    • normalize(true/false) - default is false: Designates if whitespace within a text node should be trimmed.

    • explicitRoot(true/false) - default is false: Designates if the root node should be included in the resulting object. If true, the below example output would be wrapped within a 'catalog' object.

Output Fields

  • output (object): an object constructed based on the input XML and selected options

Example XML Input

Example Object Output (based on default selections)

See Also

Functions in Workflows

About the elements of Okta Workflows