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

"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 UTC