This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

AW: how can I compare two xml files ?




> -----Ursprüngliche Nachricht-----
> Von: Richard Light [mailto:richard@light.demon.co.uk]
> Gesendet: Mittwoch, 18. April 2001 16:41
> An: Mengel Andre (FV/SLM) *
> Betreff: Re: [xsl] how can I compare two xml files ?
> 
> 
> In message 
> <55CB9FEAE87DD411A83200508BDF0DFE06D176@himail8.hi.bosch.de>,
> Mengel Andre (FV/SLM) * <Andre.Mengel@de.bosch.com> writes
> 
> >I want to compare two XML-files in order to test if they have 
> >the same content. Is it possible to use XSLT in order to solve this
> >(I am not an XSLT-Expert) problem ? What I have in mind is 
> to transform
> >both XML-files by using an XSL-sheet. Then after processing I want to
> >compare 
> >both transformed files byte for byte.
> >So the transformation would have to rearrange the attributes 
> in a unique
> >manner.
> >The structure of the xml-files I want to compare is very complex.
> >Does that imply that the XSL-file will also be very complex 
> , or is it 
> >possible to use a kind of standard-transformation without any details
> >about the xml-files themselves ?
> 
> André,
> 
> I have tackled this problem in a slightly different way.  I iterate
> through the two files, comparing them as I go.  The result is a third
> XML document which lists the differences between the two files, in a
> form which I hope can be used to reproduce the earlier version of a
> document from its current form and this 'differences' document.
> 
> The style sheet is attached, in the hope that it might be a starting
> point for your own work.
> 
> Richard Light.
> 

Hello Richard,

thank you for your fast reply refering to my question.
If I have understood you, then two xml-files would be the
same if the third file generated with your stylesheet would be
an empty file (Because no differences could be found).
Would this file also be empty if the attributes of two documents
have different orders ?
What happens if two documents are the same, but one of them 
contains ignorable whitespace ?
Excuse me for this questions but at the moment I don't have
the software to try it out myself.
I also contacted this mailing-group in order to find out if there
is a more convenient way to solve my original question.
Because another way would be to write a program that converts
the two XML-Documents to a kind of canonical form and then compare
each file byte for byte.

Best regards


André Mengel












 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]