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

Re: XML Schemas: lost "open content models"?

  • From: Stefan Haustein <haustein@k...>
  • To: "Roger L. Costello" <costello@m...>, xml-dev@x...
  • Date: Fri, 25 Feb 2000 13:04:00 +0100

xml open content model
"Roger L. Costello" wrote:
> 
> In an earlier incarnation of the XML Schema spec it allowed you to state
> that the content of an element is "open".

AFAIK, the open content model is replaced by putting <any> into the type.

> Suppose that, in the instance document, you wanted to add another child
> element of Book - perhaps you would like to add a link to Richard Bach's
> web page:

You can do this in several ways:

1. allowing <any> at the end of the Book type definition
2. derive a new element from Book (e.g. 
   <element name="XBook" equivClass="Book">...)
3. derive a new type from the Book type definition

1. has the disadvantage that you can put anything into the 
<Book> element and thus there is no possibility for e.g. an 
editor to determine if it makes sense.

2 and 3 have the disadvantage that you would need to use 
a different, extended schema, but AFAIK there is no way 
for parsers expecting schema X to determine that schema 
Y is a compatible extension of schema X. 



1.:

<element name="Book">
 <type>
  <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="*"/>
 </type>
</element>


2 and 3 would require that Book has a named 
type separated from the Book element 
definition:

<type name="Book">
  <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"/>
</type>

<element name="Book" type="Book"/>

The schema extension for 2. would look like:

<element name="XBook" equivClass="Book">
   <type source="Book" derivedBy="extension">
      <element name="AuthorsWebPage">
         ....
      </element>
   </type>
</element>

usage example:

<XBook>
   <Title>Illusions The Adventures of a Reluctant Messiah</Title>
   <Author>Richard Bach</Author>
   <Date>1977</Date>
   <ISBN>0-440-34319-4</ISBN>
   <Publisher>Dell Publishing Co.</Publisher>
   <AuthorsWebPage xlink:href="http://www.rbach.com"/>
</XBook>


The schema extension for 3. would look like:

<type name="XBook" source="Book" derivedBy="extension">
  <element name="AuthorsWebPage">

  </element>
</type>

usage example:

<Book xsi:type="XBook">
   <Title>Illusions The Adventures of a Reluctant Messiah</Title>
   <Author>Richard Bach</Author>
   <Date>1977</Date>
   <ISBN>0-440-34319-4</ISBN>
   <Publisher>Dell Publishing Co.</Publisher>
   <AuthorsWebPage xlink:href="http://www.rbach.com"/>
</Book>

Best regards

Stefan


-- 
Stefan Haustein
University of Dortmund
Computer Science VIII
www-ai.cs.uni-dortmund.de

***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/threads.html
***************************************************************************

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.