[XML Schema 1.1] defaultAttributes only apply within the schema file, not to imported or included schemas, correct?

Hi Folks,

Below I show BookStore.xsd. It specifies defaultAttributes. It imports Book.xsd, which also has a defaultAttributes. 

The defaultAttributes specified in BookStore.xsd only applies to the complexTypes within that file, and the defaultAttributes specifies in Book.xsd only applies to the complexTypes within that file, correct?

/Roger


-------------------------------
    BookStore.xsd
-------------------------------
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.bookstore.org"
           xmlns="http://www.bookstore.org"
           xmlns:bk="http://www.book.org"
           defaultAttributes="bookstoreDefaultAttributes"
           elementFormDefault="qualified">

    <xs:import namespace="http://www.book.org"
               schemaLocation="Book.xsd" />

    <xs:element name="BookStore">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="bk:Book" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:attributeGroup name="bookstoreDefaultAttributes">
        <xs:attribute name="id" type="xs:ID" use="required" />
    </xs:attributeGroup>

</xs:schema>

-------------------------------
    Book.xsd
-------------------------------
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.book.org"
           xmlns="http://www.book.org"
           defaultAttributes="bookDefaultAttributes"
           elementFormDefault="qualified">

    <xs:element name="Book">
        <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:attributeGroup name="bookDefaultAttributes">
        <xs:attribute name="class" type="xs:NMTOKENS" use="optional" />
    </xs:attributeGroup>

</xs:schema>

Received on Tuesday, 14 July 2009 12:48:43 UTC