XML parser step
Summarize
Summary of XML parser step
The XML parser step in Integration Hub enables ServiceNow customers to identify and extract structured data from XML payloads without scripting. It maps incoming XML elements to a complex object output, which can then be used in subsequent workflow steps or actions. This functionality requires an active Integration Hub subscription and the corresponding plugin.
Show less
The step is available as an action in Workflow Studio and is accessible to users with the actiondesigner role. It supports runtime payloads up to 10 MB and sample payloads up to 64,000 characters for design purposes. For XML payloads exceeding these sizes, a Data Stream action is recommended.
Key Features
- Source Data Input: Select or drag a data pill containing the XML data (e.g., REST step Response Body). Enter an example XML payload at design time to generate the complex object output structure.
- Payload Limitations: Does not support XML namespaces, multiple namespaces, multidimensional arrays, or certain special characters (hyphen, period, double colons in attributes). Payloads above 2 MB cannot be saved but can be processed temporarily.
- Structured Payload View: View example payload as raw editable XML or as a tree structure to copy element XPath for mapping.
- Output Structure Generation: Use Generate Target to auto-create the output complex object based on the example payload, or manually build it. Child elements default to String type.
- Output Element Configuration: Define labels, internal names, data types (String, Object, Array.String, Array.Object), and mandatory flags. Add nested child elements to build complex hierarchies.
- Advanced Options: Save object structures as reusable templates, set max length, hints, default values for string elements, and toggle mandatory fields.
- XPath Mapping: Modify XPath expressions to map source XML elements to complex data variables in the output. Copy XPath from payload views for accuracy. Conditional XPath expressions are not supported.
Practical Benefits
This step simplifies XML data extraction and transformation in workflows by eliminating the need for custom scripting. It ensures structured, reusable complex objects are generated from XML inputs, facilitating integration with other ServiceNow actions and steps. The visual tools for payload viewing and XPath mapping improve accuracy and efficiency in data handling within automation processes.
Identify structured data from an XML payload without having to write script. Map incoming XML elements to a complex object output that you can use in other steps or actions. At runtime, values from an XML payload populate the complex object output.
To learn more about complex objects, see Complex data.
Roles and availability
Available as an Workflow Studio action step. Users with the action_designer role can create a custom action with one or more action steps.
Payload size limit
At runtime, XML parser step supports payloads up to 10 MB. For larger payloads, create a Data Stream action. For more information, see Data Stream actions and pagination.
At design time, XML parser step supports sample payloads up to 64,000 characters.
Fields
| Field | Description |
|---|---|
| Source | In the Source data field, select or drag a data pill
that contains the source XML data. For example, a REST step Response
Body data pill. At runtime, values from the data source populate the
complex object output. Under Source data and in the scripting window, enter an example payload to generate a complex object. For example, if parsing the response from a REST API step that returns a list of users, enter the expected XML for a single user. This field accepts XML with the following limitations:
|
| Structured Payload View | Select a view for the example payload.
|
| Generate Target | Select Generate Target to create the step's output structure from your example payload. Your output data structure appears in the Target field. Child elements for each object are automatically generated as type String. Alternatively, you can manually create your target complex object by adding elements in the Target field. |
| Target | View or edit the XML payload's output structure. Create a structured output by clicking Generate Target, or manually add elements. Each element contains the following information in the Edit Object view:
Elements of type Object contain the Save as Template advanced option, which allows you to save your object's structure as a complex object template. You can then use this template to define the schema of an Object output for your action. For elements of type String, you can also add a max length, hint, and default value as advanced options. In the Target header, select Exit Edit Mode when you're
done making changes to your output's structure. You can then select the toggle
advanced inputs icon ( The XPath is the path to the element. Modify the XPath to change how source data elements map to complex data variables. If manually adding complex data variables, you can copy the XPath from the Payload view field and paste it in a complex data variable XPath field to ensure the correct hierarchy. Conditional XPath expressions are not supported. |