Daniel Veillard | f2a1283 | 2003-11-24 13:04:35 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
| 2 | <!-- $Header: /home/cvsroot/w3c-xml-schema/user/examples/first-complex-types.xsd,v 1.1 2001/11/12 20:54:00 vdv Exp $ -->
|
| 3 | <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
| 4 |
|
| 5 | <xs:simpleType name="string255">
|
| 6 | <xs:restriction base="xs:token">
|
| 7 | <xs:maxLength value="255"/>
|
| 8 | </xs:restriction>
|
| 9 | </xs:simpleType>
|
| 10 |
|
| 11 | <xs:simpleType name="string32">
|
| 12 | <xs:restriction base="xs:token">
|
| 13 | <xs:maxLength value="32"/>
|
| 14 | </xs:restriction>
|
| 15 | </xs:simpleType>
|
| 16 |
|
| 17 | <xs:simpleType name="isbn">
|
| 18 | <xs:restriction base="xs:unsignedLong">
|
| 19 | <xs:totalDigits value="10"/>
|
| 20 | <xs:pattern value="\d{10}"/>
|
| 21 | </xs:restriction>
|
| 22 | </xs:simpleType>
|
| 23 |
|
| 24 | <xs:simpleType name="bookID">
|
| 25 | <xs:restriction base="xs:ID">
|
| 26 | <xs:pattern value="b\d{10}"/>
|
| 27 | </xs:restriction>
|
| 28 | </xs:simpleType>
|
| 29 |
|
| 30 | <xs:simpleType name="supportedLanguages">
|
| 31 | <xs:restriction base="xs:language">
|
| 32 | <xs:enumeration value="en"/>
|
| 33 | <xs:enumeration value="es"/>
|
| 34 | </xs:restriction>
|
| 35 | </xs:simpleType>
|
| 36 |
|
| 37 | <xs:simpleType name="date">
|
| 38 | <xs:restriction base="xs:date">
|
| 39 | <xs:pattern value="[^:Z]*"/>
|
| 40 | </xs:restriction>
|
| 41 | </xs:simpleType>
|
| 42 |
|
| 43 | <xs:element name="name" type="string32"/>
|
| 44 | <xs:element name="qualification" type="string255"/>
|
| 45 | <xs:element name="born" type="date"/>
|
| 46 | <xs:element name="dead" type="date"/>
|
| 47 | <xs:element name="isbn" type="isbn"/>
|
| 48 |
|
| 49 | <xs:attribute name="id" type="xs:ID"/>
|
| 50 | <xs:attribute name="available" type="xs:boolean"/>
|
| 51 | <xs:attribute name="lang" type="supportedLanguages"/>
|
| 52 |
|
| 53 | <xs:complexType name="elementWithID">
|
| 54 | <xs:attribute ref="id"/>
|
| 55 | </xs:complexType>
|
| 56 |
|
| 57 | <xs:complexType name="bookTmp">
|
| 58 | <xs:complexContent>
|
| 59 | <xs:extension base="elementWithID">
|
| 60 | <xs:sequence>
|
| 61 | <xs:element ref="isbn"/>
|
| 62 | <xs:element ref="title"/>
|
| 63 | <xs:element ref="author" minOccurs="0" maxOccurs="unbounded"/>
|
| 64 | <xs:element ref="character" minOccurs="0" maxOccurs="unbounded"/>
|
| 65 | </xs:sequence>
|
| 66 | <xs:attribute ref="available"/>
|
| 67 | </xs:extension>
|
| 68 | </xs:complexContent>
|
| 69 | </xs:complexType>
|
| 70 |
|
| 71 | <xs:complexType name="personType">
|
| 72 | <xs:complexContent>
|
| 73 | <xs:extension base="elementWithID">
|
| 74 | <xs:sequence>
|
| 75 | <xs:element ref="name"/>
|
| 76 | <xs:element ref="born"/>
|
| 77 | <xs:element ref="dead" minOccurs="0"/>
|
| 78 | <xs:element ref="qualification" minOccurs="0"/>
|
| 79 | </xs:sequence>
|
| 80 | </xs:extension>
|
| 81 | </xs:complexContent>
|
| 82 | </xs:complexType>
|
| 83 |
|
| 84 | <xs:element name="title">
|
| 85 | <xs:complexType>
|
| 86 | <xs:simpleContent>
|
| 87 | <xs:extension base="string255">
|
| 88 | <xs:attribute ref="lang"/>
|
| 89 | </xs:extension>
|
| 90 | </xs:simpleContent>
|
| 91 | </xs:complexType>
|
| 92 | </xs:element>
|
| 93 |
|
| 94 | <xs:element name="library">
|
| 95 | <xs:complexType>
|
| 96 | <xs:sequence>
|
| 97 | <xs:element ref="book" maxOccurs="unbounded"/>
|
| 98 | </xs:sequence>
|
| 99 | </xs:complexType>
|
| 100 | </xs:element>
|
| 101 |
|
| 102 | <xs:element name="book">
|
| 103 | <xs:complexType>
|
| 104 | <xs:complexContent>
|
| 105 | <xs:restriction base="bookTmp">
|
| 106 | <xs:sequence>
|
| 107 | <xs:element ref="isbn"/>
|
| 108 | <xs:element ref="title"/>
|
| 109 | <xs:element ref="author" minOccurs="0" maxOccurs="unbounded"/>
|
| 110 | <xs:element ref="character" minOccurs="0" maxOccurs="unbounded"/>
|
| 111 | </xs:sequence>
|
| 112 | <xs:attribute name="id" type="bookID"/>
|
| 113 | <xs:attribute ref="available"/>
|
| 114 | </xs:restriction>
|
| 115 | </xs:complexContent>
|
| 116 | </xs:complexType>
|
| 117 | </xs:element>
|
| 118 |
|
| 119 | <xs:element name="author">
|
| 120 | <xs:complexType>
|
| 121 | <xs:complexContent>
|
| 122 | <xs:restriction base="personType">
|
| 123 | <xs:sequence>
|
| 124 | <xs:element ref="name"/>
|
| 125 | <xs:element ref="born"/>
|
| 126 | <xs:element ref="dead" minOccurs="0"/>
|
| 127 | </xs:sequence>
|
| 128 | <xs:attribute ref="id"/>
|
| 129 | </xs:restriction>
|
| 130 | </xs:complexContent>
|
| 131 | </xs:complexType>
|
| 132 | </xs:element>
|
| 133 |
|
| 134 |
|
| 135 | <xs:element name="character">
|
| 136 | <xs:complexType>
|
| 137 | <xs:complexContent>
|
| 138 | <xs:restriction base="personType">
|
| 139 | <xs:sequence>
|
| 140 | <xs:element ref="name"/>
|
| 141 | <xs:element ref="born"/>
|
| 142 | <xs:element ref="qualification"/>
|
| 143 | </xs:sequence>
|
| 144 | <xs:attribute ref="id"/>
|
| 145 | </xs:restriction>
|
| 146 | </xs:complexContent>
|
| 147 | </xs:complexType>
|
| 148 | </xs:element>
|
| 149 |
|
| 150 | </xs:schema>
|