XML JSON Diff

Choose the right component

Use the flowchart below to assist in choosing the appropriate component for your use case:

Component decision tree

The XML Diff Component leverages the diff-js-xml NPM package to compare two XML documents and show the differences between the two documents.

Actions

This action takes two strings as parameters: left XML and right XML.

The action validates both XML strings and throws an error if either is invalid.

If both strings are valid XML, the component calls the diffAsXml function of the diff-js-xml package, passing the left XML string as the argument to the lhsXml parameter and the right XML string as the argument to the rhsXml parameter.

The schema parameter is currently unsupported; the component passes null as an argument for this parameter. The component also passes null for the options parameter, which causes the diff function to use the default options.

The component emits an array containing a JSON object for each difference found by the diff function. The differences can either be of type missing element or difference in element value.

Each result object has path, type, and message fields detailing the difference found and its location in the XML string.

By default, the component returns a single message containing an array of all differences. To emit a single message for each difference, a user can select the Split result if it’s an array checkbox on the input form.