Page 1 of 1

Compare XML equivalence

Posted: Wed Jan 25, 2017 12:24 pm
by jantimmerman
There's some discussion going on and I am tasked to prove beyond doubt that two files are 'XML equivalent'. One of them has all namespace declarations on the root element and a global namespace. The other has the namespaces distributed and all elements are prefixed with a namespace (the global namespace is suddenly named 'tag0').

I am pretty sure the xml files are equivalent, but sadly Oxygen compare seems to be unable to ignore the location of namespace declarations.

Is there another way to do this? I am currently using 'Oxygen editor 16.1'. Will upgrading help in any way?

Example
File A:

Code: Select all

  <Response-APD xmlns="http://www.kadaster.nl/schemas/requests-apd/v200909" xmlns:ns2="http://www.kadaster.nl/schemas/requests-selections/v200909">
<response>
<request>
<ns2:APD>

File B:

Code: Select all

   <tag0:Response-APD xmlns:tag0="http://www.kadaster.nl/schemas/requests-apd/v200909">
<tag0:antwoord>
<tag0:vraag>
<ns2:APD xmlns:ns2="http://www.kadaster.nl/schemas/requests-selections/v200909">
These files are not equivalent according to Oxygen compare, even if I use the 'XML Accurate' setting in the Oxygen compare tool.

Re: Compare XML equivalence

Posted: Wed Jan 25, 2017 1:34 pm
by adrian
Hi,
I am pretty sure the xml files are equivalent, but sadly Oxygen compare seems to be unable to ignore the location of namespace declarations.
Is there another way to do this? I am currently using 'Oxygen editor 16.1'.
This already works in v16.1. You need to set two options in Options > Preferences, Diff > Files Comparison, XML Diff section, Ignore: Prefixes, Namespace declarations.
Note that setting these does not ignore the actual namespaces (there's a different option for that, Namespaces), it only ignores the differences in prefixes and in namespace declarations.

Later Edit: I forgot to mention that these options only apply to XML algorithms (XML Fast and XML Accurate).

Regards,
Adrian

Re: Compare XML equivalence

Posted: Thu Feb 02, 2017 6:26 pm
by jantimmerman
Hi Adrian,

Thanks for your reply. This works partially.
It ignores now the additional toplevel namespace declarations. But sadly the namespaces inside the document are still marked as 'different'.

For some reason it does work if I also select the 'ignore text' button. Which was enough for my purpose as I knew that the files were identical on content level.

Files here:
http://pastebin.com/WJgjK8Qj
http://pastebin.com/abkkARnJ

Re: Compare XML equivalence

Posted: Fri Feb 03, 2017 6:26 pm
by adrian
Hi,

Thank you for the samples. You are right. On the given example, the namespace declarations from inner elements are still marked as different.
I've logged this on our issue tracking tool to be addressed in a future version.

Regards,
Adrian