XML in Omnistudio Data Mappers (Managed Package)

For the managed package runtime, in addition to JSON, Data Mappers can have XML input and output. The XML format in Data Mappers is an unordered key/value, JSON-like structure.

Managed Package app icon This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.

To specify the order in which the elements of the XML output are serialized, populate the Expected XML Output pane with an XML structure that is composed in the desired order.

The following example compares equivalent structures in JSON and XML.

JSON

{
  "Root": {
    "#text": "rootValue",
    "@attribute1": "attVal1",
    "#ns": "http://namespace1",
    "#ns#a": "http://namespace2",
    "Child": [{
        "@attribute2": "attval2"
      },
      {
        "#text": "childValue"
      }
    ]
  }
}

XML

<Root attribute1="attVal1" xmlns="http://namespace1" xmlns:a="http://namespace2">
   rootValue
   <Child attribute2="attval2"></Child>
   <Child>childValue</Child>
</Root>

Data Mappers that transform XML to JSON use the following conventions to handle the differences between the formats.

Description

XML

JSON

Values in an input XML node are translated to output JSON with the key #text.

<Root>rootValue</Root>
                    
{
  "Root": {
    "#text": "rootValue"
  }
}

Values in an input XML node are translated to output JSON with a key that is preceded by an at sign (@).

<Root attribute1="attVal1"></Root>
{
  "Root": {
   "@attribute1": "attVal1"
  }
}

Namespaces in an input XML node are prepended with #ns in the output JSON.

<Root xmlns="http://namespace1" xmlns:a="http://namespace2">
</Root>
{
  "Root": {
"#ns":"http://namespace1",
"#ns#a":"http://namespace2,
  }
}

Colons, which are reserved characters in Data Mapper mappings, are replaced by #.

<Root:Data>data</Root:Data>
{
  "Root#Data": {
    "#text":"data",
  }
}