W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2000

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

From: Roger Costello <costello@mitre.org>
Date: Fri, 25 Feb 2000 07:02:50 -0500
Message-ID: <38B66F69.89A6BE80@mitre.org>
To: www-xml-schema-comments@w3c.org, xml-dev@xml.org
CC: "Schneider,John C." <jcs@mitre.org>, "Cokus,Michael S." <msc@mitre.org>, "Wang,David" <dwang@mitre.org>, costello@mitre.org
"Box, Don" wrote:
>  
> Look at element and attribute wildcards (<any/> and <anyAttribute/>
> respectively). They subsume the functionality of the old 
> model=open/closed attribute. 
> 
> Had your "Book" type been defined as follows:
> 
> >       <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>
> 
> You would have been fine.
> 

The <any> element does not quite give the same functionality as the old
open content model functionality.  True, as you show above, it allows me
to put any well formed XML immediately after a <Publisher> element. 
However, with the old open content model capability, I could declare the
Book element to be open, i.e., 

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

and in so doing it would enable me to place well-formed XML anywhere
within Book, e.g., I would be able to put the <AuthorsWebPage> element
before <Title>, or before <Author> etc.  Below I show it placed before
the <Date> element:

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

I suppose that I could simulate the open functionality by placing <any>
element declarations everywhere:

       <element name="Book">
            <type>
                <any minOccurs='0' maxOccurs='*'/>
                <element name="Title" type="string"/>
                <any minOccurs='0' maxOccurs='*'/>
                <element name="Author" type="string"/>
                <any minOccurs='0' maxOccurs='*'/>
                <element name="Date" type="string"/>
                <any minOccurs='0' maxOccurs='*'/>
                <element name="ISBN" type="string"/>
                <any minOccurs='0' maxOccurs='*'/>
                <element name="Publisher" type="string"/>
                <any minOccurs='0' maxOccurs='*'/>
            </type>
       </element>

Personally, I don't find this to be a very appealing idea.  I vote that
we reinstantiate the old model="open" functionality.  /Roger
Received on Friday, 25 February 2000 07:00:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:46 GMT