Skip to main content
Skip table of contents

Specifying Comparisons

To invoke a comparison you POST parameters to the specified pipeline, in either JSON or XML form.

Synchronous Comparison

Here is a simple synchronous example (asynchronous comparison is detailed on this page):

Request (XML)
XML
<comparison>
  <inputA type="http">
    <uri>http://www.example.com/file1.xml</uri>
  </inputA>
  <inputB type="http">
    <uri>http://www.example.com/file2.xml</uri>
  </inputB>
  <configurationParameters>
    <configurationParameter type="boolean">
      <name>Preserve Whitespace</name>
      <value>false</value>
    </configurationParameter>
    <configurationParameter type="string">
	  <name>Output Type</name>
      <value>full-context</value>
    </configurationParameter>
  </configurationParameters>
</comparison>



Request (JSON)
JS
{
  "inputA": {
    "type": "http",
    "uri": "http://www.example.com/file1.xml"
  },
  "inputB": {
    "type": "http",
    "uri": "http://www.example.com/file2.xml"
  },
  "configurationParameters": [
    {
      "name": "Word By Word",
      "value": true,
      "type": "boolean"
    },
    {
      "name": "Indent",
      "value": "yes",
      "type": "string"
    }
  ]
}

The request allows the pipeline parameters to be changed from their default values.

The response below indicates the comparison result, in this case an XML Delta describing the changes between the inputs specified in the request.  The ellipses would give the actual content.

Response
XML
HTTP/1.1 201 Created
<root xmlns:deltaxml="http://deltaxml.com/ns/well-formed-delta-v1" deltaxml:deltaV2="A!=B">
  <child deltaxml:deltaV2="A=B">...</child>
  <child deltaxml:deltaV2="A!=B">...</child>
</root>

The example above shows how comparison inputs could be specified using a HTTP URL. The  inputA and inputB elements in the request can contain different types of children according to the types of data being processed. This is described in more detail in the I/O types page

Comparison Model

When specifying a comparison, these are the various available objects:

Object

Description

inputA

(required)

Input A to the comparison.

See this page for the various I/O types available. 

inputB

(required)

Input B to the comparison.

See this page for the various I/O types available. 

catalog

An OASIS XML Catalog.

See this page for the various I/O types available.

configurationParameters

type = "string"

A name and string value, corresponding with a parameter in the DXP / DCP configuration.

type = "boolean"

A name and boolean value, corresponding with a parameter in the DXP / DCP configuration.

async

output

Specification of where the comparison result will be written.

See this page for the various I/O types available. 

callback

URL that will be polled after the comparison is complete.

See Callbacks in Async for more information.

Form Input

In addition to requests in structured XML or JSON format, multipart/form-data can also be used.

For example:

Request
TEXT
POST /api/xml-compare/v1/pipelines/delta HTTP/1.1
Content-Type: multipart/form-data; boundary=boundary-id
Content-Length: number_of_bytes_in_entire_request_body

--boundary-id
Content-Disposition: file; filename="file1.xml"
Content-Size: 98344
Content-Type: application/xml

... XML  ...
--boundary-id
Content-Disposition: file; filename="file2.xml"
Content-Size: 92224
Content-Type: application/xml

... XML  ...
--boundary-id

Content-Disposition: form-data; name="Word By Word"
true
--boundary-id
Content-Disposition: form-data; name="Indent"
yes
--boundary-id
Content-Disposition: form-data; name="async"
true
--boundary-id

The following table describes the parts that can make up the form-data:

Parameter

Description and example usage

A (required)

Input A

Can be specified in either a file path, a HTTP URI, or raw XML

B (required)

Input B

Can be specified in either a file path, a HTTP URI, or raw XML

output

An optional file path to write the output to

E.g. "/Users/exampleUser/Documents/test.xml"

async

Whether async comparison is used.

Default value if not specified: false

callback

Callback URL called after comparison is complete.

Note : only used with asynchronous comparisons. See this page.

catalog

An OASIS XML Catalog.

Can be specified in either a file path, a HTTP URI, or raw XML

Configuration Parameters are specified by using the name of the pipeline parameter as the name of the form data element.

For example, the example above sets two parameters - "Word By Word" and "Indent". Note each parameter is specified separately.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.