[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

From: Costello, Roger L. <costello@mitre.org>
Date: Tue, 14 Jul 2009 08:48:05 -0400
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <9E51F88D5247B648908850C35A3BBB500400458C7F@IMCMBX3.MITRE.ORG>
[XML Schema 1.1] defaultAttributes only apply within the schema  file

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 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.