Merge branch 'MDL-62945-master' of https://github.com/HuongNV13/moodle
[moodle.git] / lib / xmldb / xmldb.xsd
blob5d119a6b3ee228cfeccd4e0fee5e7ef429e559e1
1 <?xml version="1.0" encoding="UTF-8" ?>
3 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
4 <xs:simpleType name="trueFalse" >
5 <xs:restriction base="xs:NMTOKEN" >
6 <xs:enumeration value="true" />
7 <xs:enumeration value="false" />
8 </xs:restriction >
9 </xs:simpleType >
11 <xs:simpleType name="tableName" >
12 <xs:restriction base="xs:string" >
13 <xs:pattern value='[0-9a-z_]{1,28}'/>
14 </xs:restriction >
15 </xs:simpleType >
17 <xs:simpleType name="fieldName" >
18 <xs:restriction base="xs:string" >
19 <xs:pattern value='[0-9a-z_]{1,30}'/>
20 </xs:restriction >
21 </xs:simpleType >
23 <xs:simpleType name="fieldType">
24 <xs:restriction base="xs:NMTOKEN">
25 <xs:enumeration value="int" />
26 <xs:enumeration value="number" />
27 <xs:enumeration value="float" />
28 <xs:enumeration value="char" />
29 <xs:enumeration value="text" />
30 <xs:enumeration value="binary" />
31 <xs:enumeration value="datetime" />
32 </xs:restriction>
33 </xs:simpleType>
35 <xs:simpleType name="fieldLength" >
36 <xs:restriction base="xs:string" >
37 <!-- TODO: Moodle 2.5 - Drop LOB sizes, keep only numbers -->
38 <xs:pattern value='(\d+)|(small|medium|big)'/>
39 </xs:restriction >
40 </xs:simpleType >
42 <xs:simpleType name="fieldsList" >
43 <xs:restriction base="xs:string" >
44 <xs:pattern value='[0-9a-z_, ]+'/>
45 </xs:restriction >
46 </xs:simpleType >
48 <xs:simpleType name="keyType">
49 <xs:restriction base="xs:NMTOKEN">
50 <xs:enumeration value="primary" />
51 <xs:enumeration value="unique" />
52 <xs:enumeration value="foreign" />
53 <xs:enumeration value="foreign-unique" />
54 </xs:restriction>
55 </xs:simpleType>
58 <xs:element name="FIELD">
59 <xs:complexType>
60 <xs:attribute name="NAME" type="fieldName" use="required" />
61 <xs:attribute name="SEQUENCE" type="trueFalse" use="required" />
62 <xs:attribute name="TYPE" type="fieldType" use="required" />
63 <xs:attribute name="LENGTH" type="fieldLength" use="optional" />
64 <xs:attribute name="NOTNULL" type="trueFalse" use="required" />
65 <xs:attribute name="DECIMALS" type="xs:positiveInteger" use="optional" />
66 <!-- TODO: Moodle 2.4 - Drop ignored UNSIGNED attribute -->
67 <xs:attribute name="UNSIGNED" type="trueFalse" use="optional" />
68 <xs:attribute name="DEFAULT" type="xs:string" use="optional" />
69 <xs:attribute name="COMMENT" type="xs:string" use="optional" />
70 <!-- TODO: Moodle 2.6 - Drop ignored PREVIOUS/NEXT attributes -->
71 <xs:attribute name="PREVIOUS" type="fieldName" use="optional" />
72 <xs:attribute name="NEXT" type="fieldName" use="optional" />
73 </xs:complexType>
74 </xs:element>
76 <xs:element name="FIELDS">
77 <xs:complexType>
78 <xs:sequence>
79 <xs:element ref="FIELD" maxOccurs="unbounded" />
80 </xs:sequence>
81 </xs:complexType>
82 </xs:element>
84 <xs:element name="INDEX">
85 <xs:complexType>
86 <xs:attribute name="NAME" type="xs:NMTOKEN" use="required" />
87 <xs:attribute name="UNIQUE" type="trueFalse" use="required" />
88 <xs:attribute name="FIELDS" type="fieldsList" use="required" />
89 <xs:attribute name="HINTS" type="xs:string" use="optional" />
90 <xs:attribute name="COMMENT" type="xs:string" use="optional" />
91 <!-- TODO: Moodle 2.6 - Drop ignored PREVIOUS/NEXT attributes -->
92 <xs:attribute name="PREVIOUS" type="xs:NMTOKEN" use="optional" />
93 <xs:attribute name="NEXT" type="xs:NMTOKEN" use="optional" />
94 </xs:complexType>
95 </xs:element>
97 <xs:element name="INDEXES">
98 <xs:complexType>
99 <xs:sequence>
100 <xs:element ref="INDEX" maxOccurs="unbounded" />
101 </xs:sequence>
102 </xs:complexType>
103 </xs:element>
105 <xs:element name="KEY">
106 <xs:complexType>
107 <xs:attribute name="NAME" type="xs:NMTOKEN" use="required" />
108 <xs:attribute name="TYPE" type="keyType" use="required" />
109 <xs:attribute name="FIELDS" type="fieldsList" use="required" />
110 <xs:attribute name="REFTABLE" type="tableName" use="optional" />
111 <xs:attribute name="REFFIELDS" type="fieldsList" use="optional" />
112 <xs:attribute name="COMMENT" type="xs:string" use="optional" />
113 <!-- TODO: Moodle 2.6 - Drop ignored PREVIOUS/NEXT attributes -->
114 <xs:attribute name="PREVIOUS" type="xs:NMTOKEN" use="optional" />
115 <xs:attribute name="NEXT" type="xs:NMTOKEN" use="optional" />
116 </xs:complexType>
117 </xs:element>
119 <xs:element name="KEYS">
120 <xs:complexType>
121 <xs:sequence>
122 <xs:element ref="KEY" maxOccurs="unbounded" />
123 </xs:sequence>
124 </xs:complexType>
125 </xs:element>
127 <xs:element name="SENTENCE">
128 <xs:complexType>
129 <xs:attribute name="TEXT" type="xs:string" use="required" />
130 </xs:complexType>
131 </xs:element>
133 <xs:element name="SENTENCES">
134 <xs:complexType>
135 <xs:sequence>
136 <xs:element ref="SENTENCE" maxOccurs="unbounded" />
137 </xs:sequence>
138 </xs:complexType>
139 </xs:element>
141 <xs:element name="TABLE">
142 <xs:complexType>
143 <xs:sequence>
144 <xs:element ref="FIELDS" />
145 <xs:element ref="KEYS" minOccurs="0" />
146 <xs:element ref="INDEXES" minOccurs="0" />
147 </xs:sequence>
148 <xs:attribute name="NAME" type="tableName" use="required" />
149 <xs:attribute name="COMMENT" type="xs:string" use="optional" />
150 <!-- TODO: Moodle 2.6 - Drop ignored PREVIOUS/NEXT attributes -->
151 <xs:attribute name="PREVIOUS" type="tableName" use="optional" />
152 <xs:attribute name="NEXT" type="tableName" use="optional" />
153 </xs:complexType>
154 </xs:element>
156 <xs:element name="TABLES">
157 <xs:complexType>
158 <xs:sequence>
159 <xs:element ref="TABLE" maxOccurs="unbounded" />
160 </xs:sequence>
161 </xs:complexType>
162 </xs:element>
164 <xs:element name="XMLDB">
165 <xs:complexType>
166 <xs:sequence>
167 <xs:element ref="TABLES" minOccurs="0" />
168 </xs:sequence>
169 <xs:attribute name="PATH" type="xs:string" use="required" />
170 <xs:attribute name="VERSION" type="xs:string" use="required" />
171 <xs:attribute name="COMMENT" type="xs:string" use="optional" />
172 </xs:complexType>
173 </xs:element>
175 </xs:schema>