Project

Profile

Help

How to connect?
Download (4.08 KB) Statistics
| Branch: | Revision:

he / src / main / c / samples / data / books.xsd @ 55b80284

1
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
2
           xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
3
    
4
 <xs:element name="BOOKLIST">
5
  <xs:complexType>
6
   <xs:sequence>
7
    <xs:element ref="BOOKS"/>
8
    <xs:element ref="CATEGORIES"/>
9
   </xs:sequence>
10
  </xs:complexType>
11
 </xs:element>
12

    
13
 <xs:element name="BOOKS">
14
  <xs:complexType>
15
   <xs:sequence>
16
    <xs:element ref="ITEM" maxOccurs="unbounded"/>
17
   </xs:sequence>
18
   <xs:assert test="count(ITEM) le 10000" vc:minVersion="1.1"/>
19
  </xs:complexType> 
20
 </xs:element>
21

    
22
 <xs:element name="CATEGORIES">
23
  <xs:complexType mixed="true">
24
   <xs:sequence minOccurs="0" maxOccurs="unbounded">
25
    <xs:element ref="CATEGORY"/>
26
   </xs:sequence>
27
   <xs:attribute name="DESC" type="xs:string" use="required"/>
28
  </xs:complexType>
29
 </xs:element>
30
 <xs:element name="CATEGORY">
31
  <xs:complexType>
32
   <xs:attribute name="CODE" type="xs:ID" use="required"/>
33
   <xs:attribute name="DESC" type="xs:string" use="required"/>
34
   <xs:attribute name="NOTE" type="xs:string" use="optional"/>
35
  </xs:complexType>
36
 </xs:element>
37

    
38
 <xs:element name="ITEM">
39
  <xs:complexType>
40
   <xs:sequence>
41
    <xs:element name="TITLE" type="xs:string"/>
42
    <xs:element name="AUTHOR" type="xs:string"/>
43
    <xs:element name="PUBLISHER" type="xs:string"/>
44
    <xs:element name="PUB-DATE" type="xs:date"/>
45
    <xs:element name="LANGUAGE" type="languageType"/>
46
    <xs:element name="PRICE" type="moneyType"/>
47
    <xs:element name="QUANTITY" type="xs:integer"/>
48
    <xs:element name="ISBN" type="ISBNType"/>                      
49
    <xs:element name="PAGES" type="xs:integer"/>
50
    <xs:element name="DIMENSIONS" type="dimensionsType"/>
51
    <xs:element name="WEIGHT" type="weightType"/>
52
   </xs:sequence>
53
   <xs:attribute name="CAT" type="xs:IDREF" use="required"/>
54
   <xs:attribute name="TAX" type="xs:NMTOKEN" use="optional" default="V"/>
55
  </xs:complexType>
56
 </xs:element>
57
 
58
 <xs:simpleType name="languageType">
59
  <xs:restriction base="xs:string">
60
   <xs:enumeration value="English"/>
61
   <xs:enumeration value="French"/>
62
   <xs:enumeration value="German"/>
63
   <xs:enumeration value="Spanish"/>
64
  </xs:restriction>
65
 </xs:simpleType>
66
 
67
 <xs:complexType name="moneyType">
68
  <xs:simpleContent>
69
   <xs:extension base="xs:decimal">
70
    <xs:attribute name="currency" type="currencyType"/>
71
   </xs:extension> 
72
  </xs:simpleContent>
73
 </xs:complexType>
74
 
75
 <xs:simpleType name="currencyType">
76
  <xs:restriction base="xs:string">
77
   <xs:enumeration value="USD"/>
78
   <xs:enumeration value="GBP"/>
79
   <xs:enumeration value="EUR"/>
80
   <xs:enumeration value="CAD"/>
81
  </xs:restriction>
82
 </xs:simpleType> 
83
 
84
 <xs:simpleType name="ISBNType">
85
  <xs:restriction base="xs:string">
86
   <xs:pattern value="[0-9]{9}[0-9X]"/>
87
  </xs:restriction>
88
 </xs:simpleType>     
89
 
90
 <xs:complexType name="dimensionsType">
91
  <xs:simpleContent>
92
   <xs:extension base="dimensionsContentType"> 
93
    <xs:attribute name="UNIT" type="lengthUnitType"/>
94
   </xs:extension> 
95
  </xs:simpleContent>
96
 </xs:complexType>
97
 
98
 <xs:simpleType name="dimensionsContentType">
99
  <xs:restriction>
100
   <xs:simpleType>
101
    <xs:list itemType="dimensionType"/>
102
   </xs:simpleType>     
103
   <xs:length value="3"/>
104
  </xs:restriction>
105
 </xs:simpleType>  
106
 
107
 <xs:simpleType name="lengthUnitType">
108
  <xs:restriction base="xs:string">
109
   <xs:enumeration value="in"/>
110
   <xs:enumeration value="cm"/>
111
  </xs:restriction>
112
 </xs:simpleType> 
113
 
114
 <xs:simpleType name="dimensionType">
115
  <xs:restriction base="xs:decimal">
116
   <xs:minExclusive value="0.00"/>
117
  </xs:restriction>
118
 </xs:simpleType> 
119
 
120
 <xs:complexType name="weightType">
121
  <xs:simpleContent>
122
   <xs:extension base="xs:decimal">
123
    <xs:attribute name="UNIT" type="weightUnitType"/>
124
    <xs:attribute name="EXTRA" type="xs:NMTOKEN" use="optional" default="Extra"/>
125
   </xs:extension> 
126
  </xs:simpleContent>
127
 </xs:complexType>
128
 
129
 <xs:simpleType name="weightUnitType">
130
  <xs:restriction base="xs:string">
131
   <xs:enumeration value="oz"/>
132
   <xs:enumeration value="g"/>
133
  </xs:restriction>
134
 </xs:simpleType>    
135
    
136
</xs:schema>
(5-5/19)