OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Schema based XML compare


A possible approach to your problem is to read the documents in and then write both of them out in some canonical form. In this case you would have to write numbers out in the same format, and then a much simpler comparison could be done between the two documents.

As you say, it is a little bit harder to look at numeric tolerances. A crude approach to this would be to write out the numbers to say one or two decimal places, and then do the comparison. Otherwise I do not think there is a shortcut to doing a full diff and then looking at the results according to some tolerance. We did develop a mechanism for doing that using the DeltaXML deltaV2 format, which you might like to look at: http://www.deltaxml.com/library/handling-numeric-tolerances.html


David Lee wrote:
000001cba29c$fb9bca00$f2d35e00$@calldei.com" type="cite">

I've run into an age-old issue but I don’t see any off-the-shelf solutions for.


Suppose I have 2 XML documents I want to compare (not diff, just give me yes/no are they equivalent).

This is pretty simple to do even with things like ignoring whitespace options etc.  Many tools out there, including one I wrote

( http://www.xmlsh.org/CommandXcmp)


Now here's the twist …


Suppose I want to compare for XSD  data model equivalence, not XDM  equivalence ?








Without type annotation these are different.
But if I declare the type for number to  be xs:double

they should compare equal.


Thus a compare tool should be able to be given a schema and do a comparison and report that these 2 documents are equivalent at the XSD data model level.


Has anyone seen anything like this ?

Would anyone have a use for it ? (I may end up writing it for my own uses).


Not sure how far one can take this before entering murky waters …

Even in the numeric cases there are edge cases where comparisons are not well defined (rounding/precision issues on floating point numbers).

Then add in things like date/times …

But suppose I'm willing to avoid the murky edges and just stick to the obvious cases … shouldn’t be too hard right ?
In fact I suspect its so obvious its been done but I can't find one anywhere.










David A. Lee




-- -----------------------------------------------------------------
Robin La Fontaine, Director, DeltaXML Ltd  "Change control for XML"
T: +44 1684 592 144  E: robin.lafontaine@deltaxml.com      
Registered in England 02528681 Reg. Office: Monsell House, WR8 0QN, UK

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS