Diff files and namespaces

Here should go questions about transforming XML with XSLT and FOP.
mboudreau
Posts: 68
Joined: Sat Jan 07, 2017 1:23 am

Diff files and namespaces

Post by mboudreau »

I'm using Diff Files to examine pairs of files: an old file created by an existing (non-XSLT) conversion program, and a new file created by the XSLT transformation I'm working on.

The files contain many math expressions tagged in MathML. In the old files, each MathML element tag includes a namespace declaration, like this:

Code: Select all


<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mrow xmlns:mml="http://www.w3.org/1998/Math/MathML">
<mml:mrow xmlns:mml="http://www.w3.org/1998/Math/MathML">
<mml:mi xmlns:mml="http://www.w3.org/1998/Math/MathML"
>LR</mml:mi>
In the new files, the 'xmlns:mml' declaration is in the root element and so is omitted from the MathML tags.

When I compare the two files, the MathML tags are highlighted in pink, with the namespace declaration emphasized, even when I have checked the various boxes for 'Namespaces/Prefixes' in the Diff Files comparison configuration. To be more precise, the initial <mml:math> element may or may not be highlighted, but all the descendant elements are highlighted, no matter what combination of 'Namespaces', 'Prefixes', or 'Namespace declarations' is checked.

Shouldn't checking 'Namespaces' or 'Namespace declarations' ignore all namespace declarations in each file?
tavy
Posts: 364
Joined: Thu Jul 01, 2004 12:29 pm

Re: Diff files and namespaces

Post by tavy »

Hello,

For me it works fine. For example if I compare the two documents below using an XML comparison algorithm (XML Fast or XML Accurate), and I have the option Ignore Namespace Declaration set on true, no difference is presented. I tested using oXygen XML Editor 19.0.
Maybe you are using a non-XML comparison algorithm.

Code: Select all


<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mrow xmlns:mml="http://www.w3.org/1998/Math/MathML">
<mml:mrow xmlns:mml="http://www.w3.org/1998/Math/MathML">
<mml:mi xmlns:mml="http://www.w3.org/1998/Math/MathML"
>LR</mml:mi>
</mml:mrow>
</mml:mrow>
</mml:math>

Code: Select all


<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mrow>
<mml:mrow>
<mml:mi
>LR</mml:mi>
</mml:mrow>
</mml:mrow>
</mml:math>

Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
mboudreau
Posts: 68
Joined: Sat Jan 07, 2017 1:23 am

Re: Diff files and namespaces

Post by mboudreau »

Hi Octavian,

I notice that your second file includes the namespace declaration on the 'mml:math' start tag, whereas mine did not. Is this strictly necessary if I have the 'mml' namespace declaration in the root element ('article') start tag?
mboudreau
Posts: 68
Joined: Sat Jan 07, 2017 1:23 am

Re: Diff files and namespaces

Post by mboudreau »

Oddly, I can consistently reproduce this problem with large files, but not with small ones, so perhaps some more information would be helpful.

I'm using Oxygen 18.1 (build 2016112217).

I took your MathML and wrapped it in a few elements to represent in very simplified form what I'm working with. When I have 'Ignore Namespaces' checked and compare math1.xml:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<article xmlns:mml="http://www.w3.org/1998/Math/MathML">
<inline-formula>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mrow xmlns:mml="http://www.w3.org/1998/Math/MathML">
<mml:mrow xmlns:mml="http://www.w3.org/1998/Math/MathML">
<mml:mi xmlns:mml="http://www.w3.org/1998/Math/MathML">LR</mml:mi>
</mml:mrow>
</mml:mrow>
</mml:math>
</inline-formula>
</article>
to math2.xml:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<article xmlns:mml="http://www.w3.org/1998/Math/MathML">
<inline-formula>
<mml:math overflow="scroll">
<mml:mrow>
<mml:mrow>
<mml:mi>LR</mml:mi>
</mml:mrow>
</mml:mrow>
</mml:math>
</inline-formula>
</article>
there is no difference.

However, when I compare two versions of a much larger file, I get the differences indicated in this screen shot:
https://www.dropbox.com/s/26lqrxx2jc6m8 ... m.png?dl=0
teo
Posts: 57
Joined: Wed Aug 30, 2017 3:56 pm

Re: Diff files and namespaces

Post by teo »

Hello!

I analyzed the picture you posted and I noticed something I wanted to inform you.
For the "minus" sign, there is a char entity representation in the left file (&3x02212;), and that one is not present within the corresponding block of the right file (there is a simply "-" instead).
Besides, considering the same block, there are 2 different representations for the "greater than" sign: a char entity (>) in the left, and a named entity (>) in the right.

Our algorithms signal the situation described above as a difference.
Anyway, once your case analyzed, it becomes arguable for us whether or not a new option is needed in the Diff Preferences, in order to treat such representations of the same char in a more subtle manner.
I have just added a description of this problem to our issue tracker, to be more deeply analyzed and, why not, to be fixed later, in a way you could find useful.

Best regards,
Teo
Teodor Timplaru
<oXygen/> XML Editor
http://www.oxygenxml.com
mboudreau
Posts: 68
Joined: Sat Jan 07, 2017 1:23 am

Re: Diff files and namespaces

Post by mboudreau »

Thanks, Teo.

When I change the character entities in the left file to match the right, the comparison still shows the two math expressions as different:
https://www.dropbox.com/s/1monazci64qv2 ... 2.png?dl=0

(Is this the best way to include screen shots in a forum posting? I don't see a way to upload an image file.)
teo
Posts: 57
Joined: Wed Aug 30, 2017 3:56 pm

Re: Diff files and namespaces

Post by teo »

Hello!

I had a look to your last posted picture and I did not see any reason for oXygen Diff tool to signal the difference.
Then I exactly reproduced your case on my side, but I didn't get any difference highlighted.
Then I zoomed out the last screen shot received from you and I noticed a possible reason: the minus sign seems to be different in your files.
Please, check this and then let me know if the problem persists.

Best regards,
Teo
Teodor Timplaru
<oXygen/> XML Editor
http://www.oxygenxml.com
mboudreau
Posts: 68
Joined: Sat Jan 07, 2017 1:23 am

Re: Diff files and namespaces

Post by mboudreau »

Hi Teo,

I edited both files to make sure the minus sign is the same character in each, but the math elements are still highlighted as different.

I also added your original short math expression to the files, and it too was flagged as different in the two versions, as in this screen shot:

https://www.dropbox.com/s/kwz05nexaqg34 ... 3.png?dl=0

However, if I create a pair of files containing only your short math example, one with namespace declarations and one without, Diff signals no differences. The same goes for a pair of files containing only the math expression at the top of the screen shot.

So it seems the problem has something to do with the length or complexity of the files containing the math.
teo
Posts: 57
Joined: Wed Aug 30, 2017 3:56 pm

Re: Diff files and namespaces

Post by teo »

Hello again and sorry for my late reply!

I see that the problem persists, unfortunately...
Could you please send us a set of sample files, in order to exactly reproduce the issue on our side?
The analysis of the problem would be more accurate and maybe it would be easier for our Diff team to find out the real source of the issue you reported.

For posting your sample files you can use our feedback form from: https://www.oxygenxml.com/techSupport.html.

Best regards!
Teo
Teodor Timplaru
<oXygen/> XML Editor
http://www.oxygenxml.com
mboudreau
Posts: 68
Joined: Sat Jan 07, 2017 1:23 am

Re: Diff files and namespaces

Post by mboudreau »

Thanks, Teo. I uploaded the files and included a link to this forum topic.
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Diff files and namespaces

Post by Radu »

Hi Michael,

Thanks for the samples.
Just to update this thread, we'll have a fix for this in Oxygen 19.1 (in about a month or so).

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Diff files and namespaces

Post by Radu »

Hi,

Oxygen 19.1 was released and it should have a fix for this problem.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply