Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [XML Schema 1.1] Does defaultOpenContent allow me to add

From: "Michael Kay" <mike@--------.--->
To: "'Costello, Roger L.'" <costello@-----.--->, <xmlschema-dev@--.--->
Date: 6/4/2009 10:17:00 PM
OpenContent affects the elements that are permitted within the content model
of a complex type.

If you start the schema validator in strict mode, then it will find there is
no element declaration for r:MyFavoriteBookStore and report it as invalid:
that's because at this stage it's not testing the element for conformance
against a specific type, it's simply looking for an element declaration
because validation has to start somewhere. On the other hand, if you start
in lax mode, then it will skip this element and look for element
declarations that match its children, which will work just fine.

In practice most schema validators I know of insist on starting in strict
mode, though the spec doesn't require it.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay  

> -----Original Message-----
> From: xmlschema-dev-request@w... 
> [mailto:xmlschema-dev-request@w...] On Behalf Of Costello, Roger L.
> Sent: 04 June 2009 20:49
> To: 'xmlschema-dev@w...'
> Subject: [XML Schema 1.1] Does defaultOpenContent allow me to 
> add extension elements before and after the root element?
> 
> 
> Hi Folks,
> 
> Consider this schema, which uses <defaultOpenContent> to make 
> the entire schema open:
> 
> <?xml version="1.0"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>            targetNamespace="http://www.books.org"
>            xmlns="http://www.books.org"
>            elementFormDefault="qualified">
> 
>     <xs:defaultOpenContent mode="interleave">
>         <xs:any />
>     </xs:defaultOpenContent>
> 
>     <xs:element name="BookStore">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element name="Book" maxOccurs="unbounded">
>                     <xs:complexType>
>                         <xs:sequence>
>                             <xs:element name="Title" 
> type="xs:string"/>
>                             <xs:element name="Author" 
> type="xs:string" />
>                             <xs:element name="Date" type="xs:string"/>
>                             <xs:element name="ISBN" type="xs:string"/>
>                             <xs:element name="Publisher" 
> type="xs:string"/>
>                         </xs:sequence>
>                     </xs:complexType>
>                 </xs:element>
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
> 
> </xs:schema>
> 
> 
> Can I add extension elements before and after the root 
> element (BookStore)?
> 
> 
> Is this instance document legal (I have wrapped the root 
> element with an extension element):
> 
> <?xml version="1.0"?>
> <r:MyFavoriteBookStore xmlns:r="http://www.bookrepository.org">
>     <BookStore xmlns="http://www.books.org">
>         <Book>
>                 <Title>My Life and Times</Title>
>                 <Author>Paul McCartney</Author>
>                 <Date>1998</Date>
>                 <ISBN>1-56592-235-2</ISBN>
>                 <Publisher>McMillin Publishing</Publisher>
>                 <r:Binding>Hardcover</r:Binding>
>         </Book>
>         <Book>
>                 <r:Size>5 x 7</r:Size>
>                 <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>
>         </Book>
>         <Book>
>                 <Title>The First and Last Freedom</Title>
>                 <Author>J. Krishnamurti</Author>
>                 <r:NumPages>299</r:NumPages>
>                 <Date>1954</Date>
>                 <ISBN>0-06-064831-7</ISBN>
>                 <Publisher>Harper &amp; Row</Publisher>
>         </Book>
>     </BookStore>
> </r:MyFavoriteBookStore>
> 
> /Roger




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent