Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[XML Schema 1.1] Does defaultOpenContent allow me to add extension

From: "Costello, Roger L." <costello@-----.--->
To: "'xmlschema-dev@--.---'" <-------------@--.--->
Date: 6/4/2009 7:52:00 PM
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