Compare XML equivalence

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
jantimmerman
Posts: 2

Compare XML equivalence

Wed Jan 25, 2017 12:24 pm

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.
adrian
Posts: 2441

Re: Compare XML equivalence

Wed Jan 25, 2017 1:34 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
jantimmerman
Posts: 2

Re: Compare XML equivalence

Thu Feb 02, 2017 6:26 pm

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
adrian
Posts: 2441

Re: Compare XML equivalence

Fri Feb 03, 2017 6:26 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 1 guest