{"inline_business":{"xml-diff-calculator":{"swap_contents":"Swap Contents","toggle_word_wrap":"Toggle Word Wrap","toggle_minimap":"Toggle Minimap","upload_xml":"Upload XML","format":"Format","plus_n_more":"+{{value}} more","status_added":"added","status_removed":"removed","status_modified":"modified"}},"docs_business":{"tools":{"xml_diff":{"content":{"title":"Comparing two XML files: how nodes are matched and read","intro":"The comparator parses both documents with the browser's XML parser, then compares the trees node by node: tag name, attributes (in any order) and the direct text of each element. Elements carrying an id attribute are matched by that identifier, all others by position. Every node ends up added, removed, modified or unchanged.","details":"
Both texts must first be well-formed XML; otherwise the tool shows a parsing error and compares nothing. Then, for each element:
id attribute are paired by the value of that id, even if their order changed;Version 1: root with version = 1.0, a settings block where theme is dark, two users (id 1 Alice, id 2 Bob with role Admin). Version 2: version = 1.1, theme is light, an extra notifications tag, Bob becomes SuperAdmin and a user with id 3 (Charlie) appears. Result: 3 modified nodes (the root for its attribute, theme, Bob's role), 4 added nodes (notifications, user 3 and its two children) and 3 removed (user 1 with name and email). User 2 itself stays unchanged but contains a change.
In live mode the comparison reruns 0.8 seconds after the last keystroke. Unchanged branches are collapsed, and uploaded files are read in the browser without being sent anywhere.
"}},"xml-diff":{"faqs":[{"question":"Does attribute order or indentation count as a difference?","answer":"No. Attributes are compared as a set after their names are sorted, and each element's text is trimmed, so indentation and line breaks between tags are ignored. A changed attribute value, even by one character, does mark the element as modified."},{"question":"How do I compare a list of elements whose order changed?","answer":"Give each element an attribute named exactly id: the tool then pairs them by identifier regardless of position. Without an id, pairing is by rank, and an element inserted at the top makes all following ones show as modified. Other attribute names (key, ref, code) are not used for matching."},{"question":"Why does the tool show an XML parsing error?","answer":"At least one of the two documents is not well-formed: an unclosed tag, an unescaped & character, several root elements or a misplaced declaration. As long as both texts do not pass the browser's parser, no comparison runs. The format button does not help here because it does not fix syntax."},{"question":"Are CDATA sections and comments compared?","answer":"Not in the tree view: it only reads each element's direct text nodes and its attributes. A change limited to a comment or a CDATA section does not show up there. The code view, which compares the raw text line by line, does show it."}]}}}}