Diff files and namespaces

Here should go questions about transforming XML with XSLT and FOP.
mboudreau
Posts: 20

Diff files and namespaces

Mon Aug 28, 2017 6:41 pm

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: 122

Re: Diff files and namespaces

Tue Aug 29, 2017 4:42 pm

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: 20

Re: Diff files and namespaces

Tue Aug 29, 2017 7:11 pm

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: 20

Re: Diff files and namespaces

Wed Aug 30, 2017 12:03 am

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/26lqrxx2jc6m8eh/diff%20problem.png?dl=0
teo
Posts: 6

Re: Diff files and namespaces

Wed Aug 30, 2017 4:03 pm

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 (&#x0003E;) in the left, and a named entity (&gt;) 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: 20

Re: Diff files and namespaces

Wed Aug 30, 2017 5:28 pm

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/1monazci64qv2hf/diff%20problem%202.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: 6

Re: Diff files and namespaces

Thu Aug 31, 2017 9:27 am

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: 20

Re: Diff files and namespaces

Thu Aug 31, 2017 5:59 pm

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/kwz05nexaqg344i/diff%20problem%203.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: 6

Re: Diff files and namespaces

Mon Sep 04, 2017 10:52 am

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: 20

Re: Diff files and namespaces

Tue Sep 05, 2017 10:22 pm

Thanks, Teo. I uploaded the files and included a link to this forum topic.
Radu
Posts: 5088

Re: Diff files and namespaces

Thu Sep 07, 2017 8:05 am

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: 5088

Re: Diff files and namespaces

Mon Oct 02, 2017 12:01 pm

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

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests