[Home] [By Thread] [By Date] [Recent Entries]


Title: Re: Comparison of Xml documents
Pierre,

I agree with you that there is nothing in XML schema to indicate whether or not order is significant. It is an omission IMHO.

When designing DeltaXML several years ago, we came to that conclusion (it is true of DTDs also). However, we also realized that for comparison this had to be specified. So we say that:

1)
<Winners>
  <Player name="Bob"/>
  <Player name="Wil"/>
</Winners>
2)
<Winners>
  <Player name="Wil"/>
  <Player name="Bob"/>
</Winners>

are different, but that:

1)
<Winners deltaxml:ordered="false">
  <Player name="Bob"/>
  <Player name="Wil"/>
</Winners>
2)
<Winners deltaxml:ordered="false">
  <Player name="Wil"/>
  <Player name="Bob"/>
</Winners>

would be the same, i.e. no differences.

The other piece of information missing for a 'comparison schema' is information on what constitutes a 'key' to an item. In your example, the name of the Player is probably a key and if you have:

1)
<Winners deltaxml:ordered="false">
  <Player name="Bob">Captain</Player>
  <Player name="Wil"/>
</Winners>
2)
<Winners deltaxml:ordered="false">
  <Player name="Wil">Captain</Player>
  <Player name="Bob"/>
</Winners>
then it would be useful to know that Bob is not Captain, but Wil is (possible) rather than that Bob is now called Wil (unlikely). To do this you need a key, e.g.

1)
<Winners deltaxml:ordered="false">
  <Player name="Bob" deltaxml:key="Bob">Captain</Player>
  <Player name="Wil" deltaxml:key="Wil"/>
</Winners>
2)
<Winners deltaxml:ordered="false">
  <Player name="Wil" deltaxml:key="Wil">Captain</Player>
  <Player name="Bob" deltaxml:key="Bob"/>
</Winners>

Anything can be used to provide a key, but it is not the same as an ID. However, and ID will work as a key. In a comparison schema we would like to specify that the 'name' attribute identifies a 'Player' within the context of 'Winners'.
You can do this with DeltaXML, more details and an on-line trial are at http://www.deltaxml.com


Robin La Fontaine



At 10:37 am +0100 20/11/03, GARNIER Pierre wrote:
Hi all,
 
I wanted to submit you a question.

...snip
Anyone knows about such a "comparison" schema standard spec existing?
 
Thanks,
Pierre


-- 
-- ---------------------------------------------------
Robin La Fontaine,
DeltaXML: "Change control for XML, in XML"
Email: robin@d...      http://www.deltaxml.com

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member