[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: RE : Comparison of Xml documents


canonical xml comparison

Bob Foster wrote:
> 
> Bob Wyman wrote:
>  > Bob Foster wrote:
>  >
>  >>The naive approach to determining equivalence between two 
> documents  >>would be to define a recursive procedure that 
> normalizes and  >>collects element contents into sequences or 
> sets, as appropriate,  >>then compares the result for equality.  >
>  > 	I think what you really want to do here is convert the XML to
>  > "canonical form."
> 
> I really don't. Canonical form is another textual 
> representation, extra 
> overhead and an unwanted level of indirection (the comparison should 
> report the result of the comparison in terms of the original text).
> 
> But rather than respond to the rest of your note point by 
> point, let me 
> say I was disappointed that, since you know much more about 
> ASN.1 than I 
> do, you didn't respond to my main point.
> 
> I didn't forget ASN.1 as a schema language, I know about SET and 
> SEQUENCE from your earlier posts, but I don't know what they mean, in 
> the following sense.
> 
> Ordering is both a lexical and a semantic constraint. For the 
> purposes 
> of comparison, there are three possibilities: order may be lexically 
> required; order may be lexically insignificant but semantically 
> significant (like the dots and dashes in Morse code); or order may be 
> both lexically and semantically insignificant (like the items in a 
> shopping list).
> 
> Only in the latter case would I want a comparison to report that two 
> sequences that differed from each other only in order were, 
> in fact, the 
> same.
> 
> In ASN.1, does SET mean that order is both lexically and semantically 
> insignificant (as it does in mathematics)?
> 
> Or, is ASN.1 SET the same in this respect as '&' and 'all' in 
> the other 
> schema languages? Does it simply mean that order is lexically 
> insigificant with no comment on semantics, because the latter aren't 
> required for validation?
> 
> Finally, if SET does mean that order is lexically and semantically 
> insignificant, how does one specify in ASN.1 that order is lexically 
> insignificant but semantically significant?


"SEQUENCE" and "SEQUENCE OF" impose an order both at the abstract level and
in the encoding.  

"SET" and "SET OF" do not impose an order at the abstract level.  They may
or may not impose an order in the encoding.

In other words, SEQUENCE (OF) is ordered, SET (OF) is unordered - at the
abstract level.

Since a SET (OF) is "conceptually" unordered, there can be absolutely no
significance in the order in the encodings.  Some encoding rules (BER) allow
any order, other encoding rules (DER, CER, canonical XER) impose one
particular order.   Why BER allows any order is a mystery to me - historical
reasons or perhaps just convenience.  But again, no significance in the
order in the encodings.

ASN.1 per se lacks an "ALL", with its power to express **variable order**
(which is different from "no order").  To make it clearer why ALL would be
different from SET, I observe that DER/CER/CXER would NOT impose one
particular order in the encoding for ALL as they do for SET.

I don't know if the concept of "variable order" has ever been used in
relation to WXS's "all", but I think it is an effective phrase, because it
reflects the fact that, since "all" does not constrain the order, it
*positively* assigns significance (= bits of information) to the order
itself.  Individual schema writers can then ignore this significance as they
wish, but it is there for those who need it.

Alessandro


> 
> Bob Foster
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org 
> <http://www.xml.org>, an initiative of OASIS 
<http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.