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" />
11 <xs:simpleType name=
"tableName" >
12 <xs:restriction base=
"xs:string" >
13 <xs:pattern value='[
0-
9a-z_]{
1,
28}'
/>
17 <xs:simpleType name=
"fieldName" >
18 <xs:restriction base=
"xs:string" >
19 <xs:pattern value='[
0-
9a-z_]{
1,
30}'
/>
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" />
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)'
/>
42 <xs:simpleType name=
"fieldsList" >
43 <xs:restriction base=
"xs:string" >
44 <xs:pattern value='[
0-
9a-z_, ]+'
/>
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" />
58 <xs:element name=
"FIELD">
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" />
76 <xs:element name=
"FIELDS">
79 <xs:element ref=
"FIELD" maxOccurs=
"unbounded" />
84 <xs:element name=
"INDEX">
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" />
97 <xs:element name=
"INDEXES">
100 <xs:element ref=
"INDEX" maxOccurs=
"unbounded" />
105 <xs:element name=
"KEY">
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" />
119 <xs:element name=
"KEYS">
122 <xs:element ref=
"KEY" maxOccurs=
"unbounded" />
127 <xs:element name=
"SENTENCE">
129 <xs:attribute name=
"TEXT" type=
"xs:string" use=
"required" />
133 <xs:element name=
"SENTENCES">
136 <xs:element ref=
"SENTENCE" maxOccurs=
"unbounded" />
141 <xs:element name=
"TABLE">
144 <xs:element ref=
"FIELDS" />
145 <xs:element ref=
"KEYS" minOccurs=
"0" />
146 <xs:element ref=
"INDEXES" minOccurs=
"0" />
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" />
156 <xs:element name=
"TABLES">
159 <xs:element ref=
"TABLE" maxOccurs=
"unbounded" />
164 <xs:element name=
"XMLDB">
167 <xs:element ref=
"TABLES" minOccurs=
"0" />
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" />