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


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] RE : [xml-dev] Comparison of Xml documents

[ Lists Home | Date Index | Thread Index ]

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.


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

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>


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

Copyright 2001 XML.org. This site is hosted by OASIS