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

Re: Backward and forward compatible schemas ... Relax NG --> Y

  • From: "bryan rasmussen" <rasmussen.bryan@g...>
  • To: "Costello, Roger L." <costello@m...>
  • Date: Thu, 23 Aug 2007 22:07:03 +0200

Re:  Backward and forward compatible schemas ... Relax NG --> Y
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@m...> 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@l...
> subscribe: xml-dev-subscribe@l...
> 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]


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.