XML Compare
Structure-aware diff of two XML documents.
What is XML Compare?
An XML compare tool takes two XML documents, aligns them line by line, and highlights every line that was added, removed, or changed. The implementation is a line-based longest common subsequence (LCS) diff, the same algorithm Git uses, applied to the textual form of each document. Use it to see exactly which tags, attributes, or text nodes shifted without setting up a schema-aware tool.
Integration engineers, QA testers, and back-office developers reach for an XML compare tool when two payloads should match and do not. Typical inputs are SOAP request and response pairs, a SAML assertion captured from two identity providers, an Android strings.xml after a refactor, or a Maven pom.xml across two branches.
Why use XML Compare?
- Inspect SOAP and integration payloads. Diff a working request against a failing one to spot the missing element, misspelled namespace, or changed value.
- Audit config drift across environments. Compare two
web.xmlorpom.xmlfiles to find the property or dependency that diverged. - Compare SAML or OIDC metadata. Spot the certificate, endpoint, or attribute mapping that differs between two IdP exports.
- Stay private with enterprise XML. The diff runs entirely in your browser, so SOAP traffic and signed assertions never reach a server.
How to use XML Compare
- Paste the first document into the Original XML textarea on the left.
- Paste the second document into the Modified XML textarea on the right.
- Read the Diff panel below, which merges both inputs into a single patch view.
- Identify changes by color: green for added, red for removed, amber for changed, gray for unchanged context.
- Select rows and copy them into a Jira ticket or a PR comment.
Structural vs textual diff
There are two ways to compare XML. A textual diff treats the document as text and runs an LCS pass over the lines. A structural diff parses both sides into a DOM and reports differences at the element and attribute level, often ignoring formatting noise.
This tool is a textual diff. Whitespace between elements, attribute order, self-closing tags, and namespace declarations are all visible. Two documents that are structurally equivalent but formatted differently produce a noisy diff.
| Concern | Textual diff (this tool) | Structural diff |
|---|---|---|
| Whitespace between tags | Significant | Usually ignored |
| Attribute order inside a tag | Significant | Usually ignored |
| Self-closing vs paired tag | Significant | Usually equivalent |
| Namespace prefix vs URI | Compared as text | Compared by resolved URI |
The textual model fits when formatting matters or when you do not have a schema-aware tool. For large, frequently reformatted documents, run both sides through the same XML pretty-printer first.
Example diff
A SAML attribute statement after an IdP migration:
<saml:AttributeStatement>
- <saml:Attribute Name="email">
+ <saml:Attribute Name="emailAddress">
<saml:AttributeValue>alex@example.com</saml:AttributeValue>
</saml:Attribute>
- <saml:Attribute Name="role">
- <saml:AttributeValue>admin</saml:AttributeValue>
- </saml:Attribute>
+ <saml:Attribute Name="roles">
+ <saml:AttributeValue>admin</saml:AttributeValue>
+ <saml:AttributeValue>editor</saml:AttributeValue>
+ </saml:Attribute>
</saml:AttributeStatement>The diff surfaces two changes: the email attribute was renamed, and the singular role became a plural roles with two values. A service provider that only reads email and role would start failing silently.
Common use cases
- Integration engineers debugging SOAP responses. Diff a known-good response against today’s failing response to isolate schema or value drift.
- Mobile developers reviewing resource changes. Compare two
strings.xmlfiles before merging a localization branch to confirm only translated keys changed. - DevOps engineers comparing build configs. Diff two
pom.xmlfiles across release branches to find the dependency that drifted. - Identity engineers reconciling SAML metadata. Compare two IdP exports to spot the certificate or endpoint that broke single sign-on.
Frequently asked questions
Is the XML compare case-sensitive?
Yes. XML is case-sensitive by spec, so <User> and <user> are different elements. Attribute names and values are also compared case-sensitively.
Does it ignore whitespace?
No. Whitespace between elements, inside elements, and at the start of a line is significant. Run both sides through the same XML pretty-printer first to suppress format-only changes.
Does it ignore attribute order?
No. Attributes inside a tag are compared as part of the line, so reordering <input type="text" name="email"> to <input name="email" type="text"> is a changed line. A schema-aware structural diff would treat these as equivalent; the textual diff here does not.
Can I compare two XML files?
The tool reads from two textareas, not file uploads. Open both files in an editor, select all, and paste each into the matching pane. For very large documents, prefer diff or xmldiff on the command line.
Are my XML payloads uploaded anywhere?
No. The XML compare tool runs entirely in the browser. Both inputs stay in memory in your tab and are never sent to a server or logged. Closing the tab clears them, which makes the tool safe for signed SOAP messages and SAML assertions.
What is the maximum input size?
A few hundred kilobytes per side renders smoothly. Multi-megabyte documents can slow the tab because every diff row hits the DOM. For very large XML, narrow each side to the section that actually differs.
Does it validate the XML?
No. The diff treats both inputs as text and does not parse them, so a malformed document still produces a diff. To validate XML against a DTD or XSD, use a dedicated XML validator.
Why does my diff look noisy even though the data is the same?
The usual cause is different formatting on each side: one was pretty-printed, the other emitted as a single line, or the indentation widths differ. Run both inputs through the same XML formatter and re-paste.
Related tools
- Code Compare - Side-by-side diff of two code snippets with monospaced rendering.
- Text Compare - Line and word diff for two blocks of plain text.
- String Diff - Character-level diff for two short strings.
- JSON Compare - Deep-compare two JSON objects with a structured diff view.
Related tools
ShotMark captures what you do here, in one click.
The traces, payloads, and tests you run by hand? ShotMark grabs the whole bug and hands it to your AI agent.