XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
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] Backward and forward compatible schemas ... Relax NG --> Yes ... XML Schema --> No

Well first of all that is really dependent on the definition of
backwards and forwards compatibility, if you define it in such a way
that xml schema does not pass then it isn't. But the prelim points
would be:

1. sure you can have a optional before an any, but it gets dangerous.
that any should probably be in another namespace

2. the example is too simple to be useful for meaningful discussion.
surely you don't want an any that allows you to have two title
elements.

once you start constraining the any then you get into the worldviews
of the two schema models. xml schema would say well you can have your
main books namespace and work with that and then stuff you want to add
that is not in your namespace model you put into the any. as a best
practice you will probably end up having the any inside of the a
container element just for that any. this is what we did with ubl.

However it should also be noted that I believe the current plans for
xml schema 1.1 says that if you have an any and your element could be
an optional element or the any then xml schema should be validating
the optional by the validation model given for the optional element,
thus there is no confusion anymore.

Also I don't think there is a problem if both the any and the schema
are strictly validated for example.


Cheers,
Bryan Rasmussen

On 8/23/07, Costello, Roger L. <costello@mitre.org> wrote:
> Hi Folks,
>
> I am trying to characterize the types of changes to schemas which
> enable backward and forward compatibility.
>
> [Definition] An old and new schema are backward and forward compatible
> with the other if each can validate XML instance documents that were
> written to the other schema.  Thus, a new application can process XML
> instances from an old application, and an old application can process
> XML instances from a new application.
>
> Assertion: Relax NG supports backward and forward compatibility but XML
> Schemas does not.
>
> Here's how I arrived at my assertion ...
>
> Example of Two Schemas that are Backward and Forward Compatible
>
> Suppose the old schema has an "open section" where zero or more
> arbitrary elements may be inserted.  The new schema is created by
> making this change to the old schema: prepend to the open section an
> optional <Reviewer> element.
>
> The old application may produce XML instances without a <Reviewer>
> element, which is acceptable to the new application. XML documents
> produced by the new application may contain a <Reviewer> element, which
> is acceptable to the old application (since <Reviewer> will be
> considered to be part of the open section).
>
> Relax NG Implementation
>
> Old Schema:
>
>         <element name="Book">
>             <element name="Title">
>                 <text/>
>             </element>
>             <element name="Author">
>                 <text/>
>             </element>
>             <element name="Date">
>                 <text/>
>             </element>
>             <element name="ISBN">
>                 <text/>
>             </element>
>             <element name="Publisher">
>                 <text/>
>             </element>
>             <zeroOrMore>
>                 <element>
>                     <anyName/>
>                     <text/>
>                 </element>
>             </zeroOrMore>
>         </element>
>
> The contents of Book is: Title, Author, Date, ISBN, Publisher, and then
> anything (i.e. "open section").
>
> New Schema:
>
>         <element name="Book">
>             <element name="Title">
>                 <text/>
>             </element>
>             <element name="Author">
>                 <text/>
>             </element>
>             <element name="Date">
>                 <text/>
>             </element>
>             <element name="ISBN">
>                 <text/>
>             </element>
>             <element name="Publisher">
>                 <text/>
>             </element>
>             <optional>
>                 <element name="Reviewer">
>                     <text/>
>                 </element>
>             </optional>
>             <zeroOrMore>
>                 <element>
>                     <anyName/>
>                     <text/>
>                 </element>
>             </zeroOrMore>
>         </element>
>
> Now the contents of Book is: Title, Author, Date, ISBN, Publisher,
> Reviewer?, and then anything (i.e. "open section").  Observe that the
> new schema has an additional element - Reviewer.
>
> XML instances conforming to the old schema validate against the new
> schema, and XML instances conforming to the new schema validate against
> the old schema. Thus, these two schemas are backward and forward
> compatible, and Relax NG supports backward and forward compatible
> schemas.
>
> XML Schema Implementation
>
> Old Schema:
>
>         <element name="Book" maxOccurs="unbounded">
>             <complexType>
>                 <sequence>
>                     <element name="Title" type="string"/>
>                     <element name="Author" type="string"/>
>                     <element name="Date" type="string"/>
>                     <element name="ISBN" type="string"/>
>                     <element name="Publisher" type="string"/>
>                     <any minOccurs="0" maxOccurs="unbounded"/>
>                 </sequence>
>             </complexType>
>          </element>
>
> The contents of Book is: Title, Author, Date, ISBN, Publisher, and then
> anything (i.e. "open section").
>
> New Schema:
>
>
>         <element name="Book" maxOccurs="unbounded">
>             <complexType>
>                 <sequence>
>                     <element name="Title" type="string"/>
>                     <element name="Author" type="string"/>
>                     <element name="Date" type="string"/>
>                     <element name="ISBN" type="string"/>
>                     <element name="Publisher" type="string"/>
>                     <element name="Reviewer" minOccurs="0"
> type="string"/>
>                     <any minOccurs="0" maxOccurs="unbounded"/>
>                 </sequence>
>             </complexType>
>          </element>
>
> Now the contents of Book is: Title, Author, Date, ISBN, Publisher,
> Reviewer?, and then anything (i.e. "open section").  Observe that the
> new schema has an additional element - Reviewer.
>
> However, the new schema is not legal; an optional element prior to an
> <any/> is not legal, as it makes the content of Book
> "non-deterministic"; a validator will generate an error:
> Non-deterministic Content Model.  Thus, XML Schema does not support
> backward and forward compatible schemas for this type of change.
>
> Do you agree with my assertion: Relax NG supports backward and forward
> compatibility but XML Schemas does not?
>
> I am unable to think of other types of changes to a schema that would
> provide backward and forward compatibility.  Can you think of any?
>
> /Roger
>
>
>
>
>
> _______________________________________________________________________
>
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
>
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
>


[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