D A T Y P I C
Definitive XML Schema

Definitive XML Schema

Priscilla Walmsley (pwalmsley@datypic.com)
1st edition (December 7, 2001)
Prentice Hall PTR; ISBN: 0130655678
Amazon.com
Buy at 37% off list price


Chapter 12: Built-in simple types


Book Examples

Example 12-1. Invalid non-unique IDs

<order orderID="A123">
  <customer custID="A123">...</customer>
</order>


Example 12-2. Illegal duplication of ID attributes

<xsd:complexType name="CustType">
  <xsd:attribute name="id" type="xsd:ID" use="required"/>
  <xsd:attribute name="custSSN" type="xsd:ID" use="required"/>
</xsd:complexType>


Example 12-3. Illegal attribute declarations

<xsd:attribute name="id" type="xsd:ID" fixed="A123"/>
<xsd:attribute name="id" type="xsd:ID" default="A123"/>


Example 12-4. Using IDREF

<xsd:element name="quote">
  <xsd:complexType>
    <!--content model-->
    <xsd:attribute name="ref" type="xsd:IDREF"/>
  </xsd:complexType>
</xsd:element>
<xsd:element name="footnote">
  <xsd:complexType>
    <!--content model-->
    <xsd:attribute name="id" type="xsd:ID" use="required"/>
  </xsd:complexType>
</xsd:element>
<quote ref="fn1">...</quote>
<footnote id="fn1">...</footnote>


Example 12-5. Using an unparsed entity

<xsd:element name="picture">
  <xsd:complexType>
    <xsd:attribute name="location" type="xsd:ENTITY"/>
  </xsd:complexType>
</xsd:element>
<!--...-->
<!DOCTYPE catalog [
<!NOTATION jpeg SYSTEM "JPG">
<!ENTITY prod557 SYSTEM "prod557.jpg" NDATA jpeg>
<!ENTITY prod563 SYSTEM "prod563.jpg" NDATA jpeg>
]>

<catalog>
  <product>
    <number>557</number>
    <picture location="prod557"/>
  </product>
  <product>
    <number>563</number>
    <picture location="prod563"/>
  </product>
</catalog>


Example 12-6. Using ENTITIES

<xsd:element name="pictures">
  <xsd:complexType>
    <xsd:attribute name="location" type="xsd:ENTITIES"/>
  </xsd:complexType>
</xsd:element>
<!DOCTYPE catalog [
<!NOTATION jpeg SYSTEM "JPG">
<!ENTITY prod557a SYSTEM "prod557a.jpg" NDATA jpeg>
<!ENTITY prod557b SYSTEM "prod557b.jpg" NDATA jpeg>
]>

<catalog>
  <product>
    <number>557</number>
    <pictures location="prod557a prod557b"/>
  </product>
</catalog>