# XML Parser By Workato - Handling and Parsing XML

XML (eXtensible Markup Language) is a syntax for storing and transferring data, commonly used in APIs. XML data is stored in a systematic hierarchy of tags.

Because data is exposed as input fields and datapills in recipes, XML data is mostly hidden in Workato. However, if your workflow requires processing raw XML data, you can use the XML parser by Workato connector. This is the easiest way to convert raw XML data into usable datapills.

# Setup

No connection configuration is required for this connector.

# Input

When setting up this connector, you'll need to configure the following input fields:

Field Description
XML type The level of detail to parse the XML. Datapills will be typed using the data type from the XML - for example, string or integer.

Select one of the following options:
  • Simple XML without attributes - This option reads the default XML syntax and the type attribute. No other attributes are processed. The result is a simplified datatree.
  • Full XML with attributes - This option includes all attributes in the resulting datatree. Each XML tag will be an array datapill with the value of the tag in a content datapill.
Refer to the Output section below for examples of how XML data would be parsed using these options.
Sample document A sample XML document that has the same format as the XML data to be parsed.
Document The input XML data to be parsed.

# Output

The output will be the parsed XML data. The structure of the output datatree is dependent on the XML type you select.

Let's say we need to parse the following XML:

      <Name type="C">
      <Name type="C">

Click below to see what the datatree would look like for each of the XML type options:

. List
  └── Contact
      ├── Name 
      |   ├── Type (C)
      |   ├── First (Rose)
      |   └── Last (Tyler)
      ├── List size 
      └── List index
. List
  ├── Contact
  |     ├── Name
  |     |   ├── Type (C)
  |     |   ├── First
  |     |   |     ├── Content (Rose)
  |     |   |     ├── List size
  |     |   |     └── List index
  |     |   ├── Last
  |     |   |     ├── Content (Tyler)
  |     |   |     ├── List size
  |     |   |     └── List index
  |     |   ├── List size
  |     |   └── List index
  |     ├── List size 
  |     └── List index
  ├── List size 
  └── List index

# Integrating XML Into Your Workflow

Working with raw XML data in recipes is a two step process: Handling the data in recipe actions and configuring your recipes to receive XML data.

Workato provides a few ways to accomplish the latter:

  • Create an API endpoint to handle raw data. Using API recipes, you can create and expose an API endpoint that accepts raw XML data. Learn more.

  • Develop a custom connector. Custom connectors allow you to customize how you receive and interact with your cloud applications through API calls. Use the following options to DIY a connector:

    • HTTP connector - This connector provides a convenient way to handle raw data from APIs. Check out the HTTP connector course (opens new window) for more info.

    • Connector SDK - An extension of the Workato framework, the Connector SDK provides everything developers need to build, maintain, and distribute connectors. Check out the Workato SDK documentation for more info.

    Not sure which option is right for you? Check out the HTTP vs. SDK guide for a detailed comparison.