Merge "languages: Add NS_CATEGORY and #REDIRECT for hyw"
[lhc/web/wiklou.git] / docs / export-0.9.xsd
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!--
3 This is an XML Schema description of the format
4 output by MediaWiki's Special:Export system.
5
6 Version 0.2 adds optional basic file upload info support,
7 which is used by our OAI export/import submodule.
8
9 Version 0.3 adds some site configuration information such
10 as a list of defined namespaces.
11
12 Version 0.4 adds per-revision delete flags, log exports,
13 discussion threading data, a per-page redirect flag, and
14 per-namespace capitalization.
15
16 Version 0.5 adds byte count per revision.
17
18 Version 0.6 adds a separate namespace tag, and resolves the
19 redirect target and adds a separate sha1 tag for each revision.
20
21 Version 0.7 adds a unique identity constraint for both page and
22 revision identifiers. See also bug 4220.
23 Fix type for <ns> from "positiveInteger" to "nonNegativeInteger" to allow 0
24 Moves <logitem> to its right location.
25 Add parentid to revision.
26 Fix type for <id> within <contributor> to "nonNegativeInteger"
27
28 Version 0.8 adds support for a <model> and a <format> tag for
29 each revision. See contenthandler.txt.
30
31 Version 0.9 adds the database name to the site information.
32
33 The canonical URL to the schema document is:
34 http://www.mediawiki.org/xml/export-0.9.xsd
35
36 Use the namespace:
37 http://www.mediawiki.org/xml/export-0.9/
38 -->
39 <schema xmlns="http://www.w3.org/2001/XMLSchema"
40 xmlns:mw="http://www.mediawiki.org/xml/export-0.9/"
41 targetNamespace="http://www.mediawiki.org/xml/export-0.9/"
42 elementFormDefault="qualified">
43
44 <annotation>
45 <documentation xml:lang="en">
46 MediaWiki's page export format
47 </documentation>
48 </annotation>
49
50 <!-- Need this to reference xml:lang -->
51 <import namespace="http://www.w3.org/XML/1998/namespace"
52 schemaLocation="http://www.w3.org/2001/xml.xsd" />
53
54 <!-- Our root element -->
55 <element name="mediawiki" type="mw:MediaWikiType">
56 <!-- Page ID contraint, see bug 4220 -->
57 <unique name="PageIDConstraint">
58 <selector xpath="mw:page" />
59 <field xpath="mw:id" />
60 </unique>
61 <!-- Revision ID contraint, see bug 4220 -->
62 <unique name="RevIDConstraint">
63 <selector xpath="mw:page/mw:revision" />
64 <field xpath="mw:id" />
65 </unique>
66 </element>
67
68 <complexType name="MediaWikiType">
69 <sequence>
70 <element name="siteinfo" type="mw:SiteInfoType"
71 minOccurs="0" maxOccurs="1" />
72 <element name="page" type="mw:PageType"
73 minOccurs="0" maxOccurs="unbounded" />
74 <element name="logitem" type="mw:LogItemType"
75 minOccurs="0" maxOccurs="unbounded" />
76 </sequence>
77 <attribute name="version" type="string" use="required" />
78 <attribute ref="xml:lang" use="required" />
79 </complexType>
80
81 <complexType name="SiteInfoType">
82 <sequence>
83 <element name="sitename" type="string" minOccurs="0" />
84 <element name="dbname" type="string" minOccurs="0" />
85 <element name="base" type="anyURI" minOccurs="0" />
86 <element name="generator" type="string" minOccurs="0" />
87 <element name="case" type="mw:CaseType" minOccurs="0" />
88 <element name="namespaces" type="mw:NamespacesType" minOccurs="0" />
89 </sequence>
90 </complexType>
91
92 <simpleType name="CaseType">
93 <restriction base="NMTOKEN">
94 <!-- Cannot have two titles differing only by case of first letter. -->
95 <!-- Default behavior through 1.5, $wgCapitalLinks = true -->
96 <enumeration value="first-letter" />
97
98 <!-- Complete title is case-sensitive -->
99 <!-- Behavior when $wgCapitalLinks = false -->
100 <enumeration value="case-sensitive" />
101
102 <!-- Cannot have non-case senstitive titles eg [[FOO]] == [[Foo]] -->
103 <!-- Not yet implemented as of MediaWiki 1.18 -->
104 <enumeration value="case-insensitive" />
105 </restriction>
106 </simpleType>
107
108 <simpleType name="DeletedFlagType">
109 <restriction base="NMTOKEN">
110 <enumeration value="deleted" />
111 </restriction>
112 </simpleType>
113
114 <complexType name="NamespacesType">
115 <sequence>
116 <element name="namespace" type="mw:NamespaceType"
117 minOccurs="0" maxOccurs="unbounded" />
118 </sequence>
119 </complexType>
120
121 <complexType name="NamespaceType">
122 <simpleContent>
123 <extension base="string">
124 <attribute name="key" type="integer" />
125 <attribute name="case" type="mw:CaseType" />
126 </extension>
127 </simpleContent>
128 </complexType>
129
130 <complexType name="RedirectType">
131 <simpleContent>
132 <extension base="string">
133 <attribute name="title" type="string" />
134 </extension>
135 </simpleContent>
136 </complexType>
137
138 <simpleType name="ContentModelType">
139 <restriction base="string">
140 <pattern value="[a-zA-Z][-+./a-zA-Z0-9]*" />
141 </restriction>
142 </simpleType>
143
144 <simpleType name="ContentFormatType">
145 <restriction base="string">
146 <pattern value="[a-zA-Z][-+.a-zA-Z0-9]*/[a-zA-Z][-+.a-zA-Z0-9]*" />
147 </restriction>
148 </simpleType>
149
150 <complexType name="PageType">
151 <sequence>
152 <!-- Title in text form. (Using spaces, not underscores; with namespace ) -->
153 <element name="title" type="string" />
154
155 <!-- Namespace in canonical form -->
156 <element name="ns" type="nonNegativeInteger" />
157
158 <!-- optional page ID number -->
159 <element name="id" type="positiveInteger" />
160
161 <!-- flag if the current revision is a redirect -->
162 <element name="redirect" type="mw:RedirectType" minOccurs="0" maxOccurs="1" />
163
164 <!-- comma-separated list of string tokens, if present -->
165 <element name="restrictions" type="string" minOccurs="0" />
166
167 <!-- Zero or more sets of revision or upload data -->
168 <choice minOccurs="0" maxOccurs="unbounded">
169 <element name="revision" type="mw:RevisionType" />
170 <element name="upload" type="mw:UploadType" />
171 </choice>
172
173 <!-- Zero or One sets of discussion threading data -->
174 <element name="discussionthreadinginfo" minOccurs="0" maxOccurs="1" type="mw:DiscussionThreadingInfo" />
175 </sequence>
176 </complexType>
177
178 <complexType name="RevisionType">
179 <sequence>
180 <element name="id" type="positiveInteger" />
181 <element name="parentid" type="positiveInteger" minOccurs="0" />
182 <element name="timestamp" type="dateTime" />
183 <element name="contributor" type="mw:ContributorType" />
184 <element name="minor" minOccurs="0" maxOccurs="1" />
185 <element name="comment" type="mw:CommentType" minOccurs="0" maxOccurs="1" />
186 <element name="text" type="mw:TextType" />
187 <element name="sha1" type="string" />
188 <element name="model" type="mw:ContentModelType" />
189 <element name="format" type="mw:ContentFormatType" />
190 </sequence>
191 </complexType>
192
193 <complexType name="LogItemType">
194 <sequence>
195 <element name="id" type="positiveInteger" />
196 <element name="timestamp" type="dateTime" />
197 <element name="contributor" type="mw:ContributorType" />
198 <element name="comment" type="mw:CommentType" minOccurs="0" />
199 <element name="type" type="string" />
200 <element name="action" type="string" />
201 <element name="text" type="mw:LogTextType" minOccurs="0" maxOccurs="1" />
202 <element name="logtitle" type="string" minOccurs="0" maxOccurs="1" />
203 <element name="params" type="mw:LogParamsType" minOccurs="0" maxOccurs="1" />
204 </sequence>
205 </complexType>
206
207 <complexType name="CommentType">
208 <simpleContent>
209 <extension base="string">
210 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
211 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
212 </extension>
213 </simpleContent>
214 </complexType>
215
216 <complexType name="TextType">
217 <simpleContent>
218 <extension base="string">
219 <attribute ref="xml:space" use="optional" default="preserve" />
220 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
221 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
222 <!-- This isn't a good idea; we should be using "ID" instead of "NMTOKEN" -->
223 <!-- However, "NMTOKEN" is strictest definition that is both compatible with existing -->
224 <!-- usage ([0-9]+) and with the "ID" type. -->
225 <attribute name="id" type="NMTOKEN" />
226 <attribute name="bytes" use="optional" type="nonNegativeInteger" />
227 </extension>
228 </simpleContent>
229 </complexType>
230
231 <complexType name="LogTextType">
232 <simpleContent>
233 <extension base="string">
234 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
235 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
236 </extension>
237 </simpleContent>
238 </complexType>
239
240 <complexType name="LogParamsType">
241 <simpleContent>
242 <extension base="string">
243 <attribute ref="xml:space" use="optional" default="preserve" />
244 </extension>
245 </simpleContent>
246 </complexType>
247
248 <complexType name="ContributorType">
249 <sequence>
250 <element name="username" type="string" minOccurs="0" />
251 <element name="id" type="nonNegativeInteger" minOccurs="0" />
252
253 <element name="ip" type="string" minOccurs="0" />
254 </sequence>
255 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
256 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
257 </complexType>
258
259 <complexType name="UploadType">
260 <sequence>
261 <!-- Revision-style data... -->
262 <element name="timestamp" type="dateTime" />
263 <element name="contributor" type="mw:ContributorType" />
264 <element name="comment" type="string" minOccurs="0" />
265
266 <!-- Filename. (Using underscores, not spaces. No 'File:' namespace marker.) -->
267 <element name="filename" type="string" />
268
269 <!-- URI at which this resource can be obtained -->
270 <element name="src" type="anyURI" />
271
272 <element name="size" type="positiveInteger" />
273
274 <!-- TODO: add other metadata fields -->
275 </sequence>
276 </complexType>
277
278 <!-- Discussion threading data for LiquidThreads -->
279 <complexType name="DiscussionThreadingInfo">
280 <sequence>
281 <element name="ThreadSubject" type="string" />
282 <element name="ThreadParent" type="positiveInteger" />
283 <element name="ThreadAncestor" type="positiveInteger" />
284 <element name="ThreadPage" type="string" />
285 <element name="ThreadID" type="positiveInteger" />
286 <element name="ThreadAuthor" type="string" />
287 <element name="ThreadEditStatus" type="string" />
288 <element name="ThreadType" type="string" />
289 </sequence>
290 </complexType>
291
292 </schema>