curl --request POST \
--url https://api.iotools.cloud/v1/tool/xml-diff-comparator \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"xmlA": "<?xml version=\"1.0\"?>\n<library>\n <book id=\"1\" genre=\"fiction\">\n <title>The Hobbit</title>\n <author>J.R.R. Tolkien</author>\n <year>1937</year>\n </book>\n <book id=\"2\" genre=\"science\">\n <title>A Brief History of Time</title>\n <author>Stephen Hawking</author>\n <year>1988</year>\n </book>\n</library>",
"xmlB": "<?xml version=\"1.0\"?>\n<library>\n <book id=\"1\" genre=\"fantasy\">\n <title>The Hobbit</title>\n <author>J.R.R. Tolkien</author>\n <year>1937</year>\n <pages>310</pages>\n </book>\n <book id=\"3\" genre=\"history\">\n <title>Sapiens</title>\n <author>Yuval Noah Harari</author>\n <year>2011</year>\n </book>\n</library>",
"ignoreWhitespace": "true",
"ignoreComments": "true"
}
'{
"tool": "xml-diff-comparator",
"tool_version": "1.0.2",
"outputs": {
"summary": [
{
"metric": "Added",
"value": "1"
},
{
"metric": "Removed",
"value": "0"
},
{
"metric": "Modified",
"value": "3"
},
{
"metric": "Attribute changes",
"value": "3"
},
{
"metric": "Result",
"value": "7 differences"
}
],
"structuralDiff": "~ /library/book[1] @genre: \"fiction\" -> \"fantasy\"\n+ /library/book[1]/pages <pages>310</pages>\n~ /library/book[2] @id: \"2\" -> \"3\"\n~ /library/book[2] @genre: \"science\" -> \"history\"\n~ /library/book[2]/title text: \"A Brief History of Time\" -> \"Sapiens\"\n~ /library/book[2]/author text: \"Stephen Hawking\" -> \"Yuval Noah Harari\"\n~ /library/book[2]/year text: \"1988\" -> \"2011\"",
"unifiedDiff": "--- XML A\n+++ XML B\n@@ -1,12 +1,13 @@\n <library>\n- <book id=\"1\" genre=\"fiction\">\n+ <book id=\"1\" genre=\"fantasy\">\n <title>The Hobbit</title>\n <author>J.R.R. Tolkien</author>\n <year>1937</year>\n+ <pages>310</pages>\n </book>\n- <book id=\"2\" genre=\"science\">\n- <title>A Brief History of Time</title>\n- <author>Stephen Hawking</author>\n- <year>1988</year>\n+ <book id=\"3\" genre=\"history\">\n+ <title>Sapiens</title>\n+ <author>Yuval Noah Harari</author>\n+ <year>2011</year>\n </book>\n </library>\n\\ No newline at end of file",
"diffHtml": "<div style=\"font-family:monospace;white-space:pre-wrap\"><div><library></div><div> <book id=\"1\" genre=\"<span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">fiction</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">fantasy</span>\"></div><div> <title>The Hobbit</title></div><div> <author>J.R.R. Tolkien</author></div><div> <year>1937</year></div><div><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\"> <pages>310</pages></span></div><div> </book></div><div> <book id=\"<span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">2</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">3</span>\" genre=\"<span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">science</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">history</span>\"></div><div> <title><span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">A Brief History of Time</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">Sapiens</span></title></div><div> <author><span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">Stephen</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">Yuval</span> <span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">Hawking</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">Noah Harari</span></author></div><div> <year><span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">1988</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">2011</span></year></div><div> </book></div><div></library></div></div>"
},
"credits_used": 5,
"credits_remaining": null
}Utilities
XML Diff Comparator
Compare two XML documents and see exactly what changed — added/removed elements, attribute changes and text changes with an XPath-like path to each one, plus a unified line diff of the normalized markup. Runs entirely in your browser.
POST
/
v1
/
tool
/
xml-diff-comparator
curl --request POST \
--url https://api.iotools.cloud/v1/tool/xml-diff-comparator \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"xmlA": "<?xml version=\"1.0\"?>\n<library>\n <book id=\"1\" genre=\"fiction\">\n <title>The Hobbit</title>\n <author>J.R.R. Tolkien</author>\n <year>1937</year>\n </book>\n <book id=\"2\" genre=\"science\">\n <title>A Brief History of Time</title>\n <author>Stephen Hawking</author>\n <year>1988</year>\n </book>\n</library>",
"xmlB": "<?xml version=\"1.0\"?>\n<library>\n <book id=\"1\" genre=\"fantasy\">\n <title>The Hobbit</title>\n <author>J.R.R. Tolkien</author>\n <year>1937</year>\n <pages>310</pages>\n </book>\n <book id=\"3\" genre=\"history\">\n <title>Sapiens</title>\n <author>Yuval Noah Harari</author>\n <year>2011</year>\n </book>\n</library>",
"ignoreWhitespace": "true",
"ignoreComments": "true"
}
'{
"tool": "xml-diff-comparator",
"tool_version": "1.0.2",
"outputs": {
"summary": [
{
"metric": "Added",
"value": "1"
},
{
"metric": "Removed",
"value": "0"
},
{
"metric": "Modified",
"value": "3"
},
{
"metric": "Attribute changes",
"value": "3"
},
{
"metric": "Result",
"value": "7 differences"
}
],
"structuralDiff": "~ /library/book[1] @genre: \"fiction\" -> \"fantasy\"\n+ /library/book[1]/pages <pages>310</pages>\n~ /library/book[2] @id: \"2\" -> \"3\"\n~ /library/book[2] @genre: \"science\" -> \"history\"\n~ /library/book[2]/title text: \"A Brief History of Time\" -> \"Sapiens\"\n~ /library/book[2]/author text: \"Stephen Hawking\" -> \"Yuval Noah Harari\"\n~ /library/book[2]/year text: \"1988\" -> \"2011\"",
"unifiedDiff": "--- XML A\n+++ XML B\n@@ -1,12 +1,13 @@\n <library>\n- <book id=\"1\" genre=\"fiction\">\n+ <book id=\"1\" genre=\"fantasy\">\n <title>The Hobbit</title>\n <author>J.R.R. Tolkien</author>\n <year>1937</year>\n+ <pages>310</pages>\n </book>\n- <book id=\"2\" genre=\"science\">\n- <title>A Brief History of Time</title>\n- <author>Stephen Hawking</author>\n- <year>1988</year>\n+ <book id=\"3\" genre=\"history\">\n+ <title>Sapiens</title>\n+ <author>Yuval Noah Harari</author>\n+ <year>2011</year>\n </book>\n </library>\n\\ No newline at end of file",
"diffHtml": "<div style=\"font-family:monospace;white-space:pre-wrap\"><div><library></div><div> <book id=\"1\" genre=\"<span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">fiction</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">fantasy</span>\"></div><div> <title>The Hobbit</title></div><div> <author>J.R.R. Tolkien</author></div><div> <year>1937</year></div><div><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\"> <pages>310</pages></span></div><div> </book></div><div> <book id=\"<span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">2</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">3</span>\" genre=\"<span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">science</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">history</span>\"></div><div> <title><span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">A Brief History of Time</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">Sapiens</span></title></div><div> <author><span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">Stephen</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">Yuval</span> <span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">Hawking</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">Noah Harari</span></author></div><div> <year><span style=\"color:#b91c1c;background-color:#fee2e2;text-decoration:line-through\">1988</span><span style=\"color:#15803d;background-color:#dcfce7;text-decoration:underline\">2011</span></year></div><div> </book></div><div></library></div></div>"
},
"credits_used": 5,
"credits_remaining": null
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
Tool output
Show child attributes
Show child attributes
The tool's slug, echoing the {slug} in the request path.
Output-contract version for this tool.
Credits this call consumed, after any settlement refund. 0 when metering is disabled.
Credits left in the current monthly allowance, or null when metering is disabled.
Correlation id, also sent as x-request-id.
Was this page helpful?