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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

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

[ Lists Home | Date Index | Thread Index ]
  • From: Stefan Haustein <haustein@kimo.cs.uni-dortmund.de>
  • To: "Roger L. Costello" <costello@mitre.org>, xml-dev@xml.org
  • Date: Fri, 25 Feb 2000 13:04:00 +0100

"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@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/threads.html
***************************************************************************




 

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

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