Specifying Comparisons
Synchronous Comparison
Here is a simple comparison, ran from Postman:
Use the POST command with this string: http://0.0.0.0:8080/api/xml-data-compare/v1/compare
Request (XML)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<compare>
<input-a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="file">
<path>/Users/user1/Documents/sample data/ordering/addressesA.xml</path>
</input-a>
<input-b xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="file">
<path>/Users/user1/Documents/sample data/ordering/addressesB.xml</path>
</input-b>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="file">
<path>/Users/user1/Documents/sample data/ordering/config-ignore-order-with-key.xml</path>
</configuration>
</compare>
Request (JSON)
{
"input-a": {
"type": "file",
"path": "/Users/user1/Documents/sample data/ordering/addressesA.xml"
},
"input-b": {
"type": "file",
"path": "/Users/user1/Documents/sample data/ordering/addressesB.xml"
},
"configuration": {
"type": "file",
"path": "/Users/user1/Documents/sample data/ordering/config-ignore-order-with-key.xml"
}
}
Note that the result of the comparison is always in XML but any errors can be shown in either XML or JSON.
Comparison Model
When specifying a comparison, these are the various available objects. See this page for the various I/O types available.
Object | Description | |
---|---|---|
inputA (required) | Input A to the comparison. | |
inputB (required) | Input B to the comparison. | |
configuration | The configuration file for the comparison. See the schema definition and Basics: Configuration File for more information. | |
diagnosticsMode | An optional boolean value indicating whether to display more precise information about the runtime XPath errors along with a location in the configuration file. Set this to false once a comparison is running satisfactorily to speed up the process. By default, the diagnosticsMode is set to true. | |
async | output | An optional file path to write the output to E.g. "/Users/exampleUser/Documents/test.xml" |
callback | An optional callback URL. See Callbacks in Async for more information. |
Form Input
In addition to requests in structured XML / JSON format, multipart/form-data can also be used.
For example:
Request
POST /api/xml-data-compare/v1/compare 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
--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 | Default Value (if not specified) | |
---|---|---|---|
A (required) | Input A Can be specified in either a file path, an HTTP URI, or raw XML. | N/A | |
B (required) | Input B Can be specified in either a file path, an HTTP URI, or raw XML | N/A | |
config | The configuration file Can be specified in either a file path, an HTTP URI, or raw XML | N/A | |
diagnosticsMode | An optional boolean value indicating whether to display more precise information about the runtime XPath errors along with a location in the configuration file. Set this to false once a comparison is running satisfactorily to speed up the process. | true | |
async | Whether async comparison is used. | false | |
async.callback | Callback URL called after comparison is complete. Note : only used with asynchronous comparisons. See this page. | N/A | |
async.output | An optional file path to write the output to E.g. "/Users/exampleUser/Documents/test.xml" | N/A |