1 <?xml version=
"1.0" encoding=
"UTF-8" ?>
3 This is an XML Schema description of the format
4 output by MediaWiki's Special:Export system.
6 Version 0.2 adds optional basic file upload info support,
7 which is used by our OAI export/import submodule.
9 Version 0.3 adds some site configuration information such
10 as a list of defined namespaces.
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.
16 Version 0.5 adds byte count per revision.
18 Version 0.6 adds a separate namespace tag, and resolves the
19 redirect target and adds a separate sha1 tag for each revision.
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"
28 Version 0.8 adds support for a <model> and a <format> tag for
29 each revision. See contenthandler.md.
31 Version 0.9 adds the database name to the site information.
33 Version 0.10 moved the <model> and <format> tags before the <text> tag.
35 Version 0.11 introduced <content> tag.
37 The canonical URL to the schema document is:
38 https://www.mediawiki.org/xml/export-0.11.xsd
41 https://www.mediawiki.org/xml/export-0.11/
43 <schema xmlns=
"http://www.w3.org/2001/XMLSchema"
44 xmlns:
mw=
"http://www.mediawiki.org/xml/export-0.11/"
45 targetNamespace=
"http://www.mediawiki.org/xml/export-0.11/"
46 elementFormDefault=
"qualified">
49 <documentation xml:
lang=
"en">
50 MediaWiki's page export format
54 <!-- Need this to reference xml:lang -->
55 <import namespace=
"http://www.w3.org/XML/1998/namespace"
56 schemaLocation=
"http://www.w3.org/2001/xml.xsd" />
58 <!-- Our root element -->
59 <element name=
"mediawiki" type=
"mw:MediaWikiType">
60 <!-- Page ID contraint, see bug 4220 -->
61 <unique name=
"PageIDConstraint">
62 <selector xpath=
"mw:page" />
63 <field xpath=
"mw:id" />
65 <!-- Revision ID contraint, see bug 4220 -->
66 <unique name=
"RevIDConstraint">
67 <selector xpath=
"mw:page/mw:revision" />
68 <field xpath=
"mw:id" />
72 <complexType name=
"MediaWikiType">
74 <element name=
"siteinfo" type=
"mw:SiteInfoType"
75 minOccurs=
"0" maxOccurs=
"1" />
76 <element name=
"page" type=
"mw:PageType"
77 minOccurs=
"0" maxOccurs=
"unbounded" />
78 <element name=
"logitem" type=
"mw:LogItemType"
79 minOccurs=
"0" maxOccurs=
"unbounded" />
81 <attribute name=
"version" type=
"string" use=
"required" />
82 <attribute ref=
"xml:lang" use=
"required" />
85 <complexType name=
"SiteInfoType">
87 <element name=
"sitename" type=
"string" minOccurs=
"0" />
88 <element name=
"dbname" type=
"string" minOccurs=
"0" />
89 <element name=
"base" type=
"anyURI" minOccurs=
"0" />
90 <element name=
"generator" type=
"string" minOccurs=
"0" />
91 <element name=
"case" type=
"mw:CaseType" minOccurs=
"0" />
92 <element name=
"namespaces" type=
"mw:NamespacesType" minOccurs=
"0" />
96 <simpleType name=
"CaseType">
97 <restriction base=
"NMTOKEN">
98 <!-- Cannot have two titles differing only by case of first letter. -->
99 <!-- Default behavior through 1.5, $wgCapitalLinks = true -->
100 <enumeration value=
"first-letter" />
102 <!-- Complete title is case-sensitive -->
103 <!-- Behavior when $wgCapitalLinks = false -->
104 <enumeration value=
"case-sensitive" />
106 <!-- Cannot have non-case senstitive titles eg [[FOO]] == [[Foo]] -->
107 <!-- Not yet implemented as of MediaWiki 1.18 -->
108 <enumeration value=
"case-insensitive" />
112 <simpleType name=
"DeletedFlagType">
113 <restriction base=
"NMTOKEN">
114 <enumeration value=
"deleted" />
118 <complexType name=
"NamespacesType">
120 <element name=
"namespace" type=
"mw:NamespaceType"
121 minOccurs=
"0" maxOccurs=
"unbounded" />
125 <complexType name=
"NamespaceType">
127 <extension base=
"string">
128 <attribute name=
"key" type=
"integer" />
129 <attribute name=
"case" type=
"mw:CaseType" />
134 <complexType name=
"RedirectType">
136 <extension base=
"string">
137 <attribute name=
"title" type=
"string" />
142 <simpleType name=
"ContentModelType">
143 <restriction base=
"string">
144 <pattern value=
"[a-zA-Z][-+./a-zA-Z0-9]*" />
148 <simpleType name=
"ContentFormatType">
149 <restriction base=
"string">
150 <pattern value=
"[a-zA-Z][-+.a-zA-Z0-9]*/[a-zA-Z][-+.a-zA-Z0-9]*" />
154 <complexType name=
"PageType">
156 <!-- Title in text form. (Using spaces, not underscores; with namespace ) -->
157 <element name=
"title" type=
"string" />
159 <!-- Namespace in canonical form -->
160 <element name=
"ns" type=
"nonNegativeInteger" />
162 <!-- optional page ID number -->
163 <element name=
"id" type=
"positiveInteger" />
165 <!-- flag if the current revision is a redirect -->
166 <element name=
"redirect" type=
"mw:RedirectType" minOccurs=
"0" maxOccurs=
"1" />
168 <!-- comma-separated list of string tokens, if present -->
169 <element name=
"restrictions" type=
"string" minOccurs=
"0" />
171 <!-- Zero or more sets of revision or upload data -->
172 <choice minOccurs=
"0" maxOccurs=
"unbounded">
173 <element name=
"revision" type=
"mw:RevisionType" />
174 <element name=
"upload" type=
"mw:UploadType" />
177 <!-- Zero or One sets of discussion threading data -->
178 <element name=
"discussionthreadinginfo" minOccurs=
"0" maxOccurs=
"1" type=
"mw:DiscussionThreadingInfo" />
182 <complexType name=
"RevisionType">
184 <element name=
"id" type=
"positiveInteger" />
185 <element name=
"parentid" type=
"positiveInteger" minOccurs=
"0" maxOccurs=
"1" />
186 <element name=
"timestamp" type=
"dateTime" />
187 <element name=
"contributor" type=
"mw:ContributorType" />
188 <element name=
"minor" minOccurs=
"0" maxOccurs=
"1" />
189 <element name=
"comment" type=
"mw:CommentType" minOccurs=
"0" maxOccurs=
"1" />
190 <!-- corresponds to slot origin for the main slot -->
191 <element name=
"origin" type=
"positiveInteger" />
192 <!-- the main slot's content model -->
193 <element name=
"model" type=
"mw:ContentModelType" />
194 <!-- the main slot's serialization format -->
195 <element name=
"format" type=
"mw:ContentFormatType" />
196 <!-- the main slot's serialized content -->
197 <element name=
"text" type=
"mw:TextType"/>
198 <element name=
"content" type=
"mw:ContentType" minOccurs=
"0" maxOccurs=
"unbounded"/>
199 <!-- sha1 of the revision, a combined sha1 of content in all slots -->
200 <element name=
"sha1" type=
"string" />
204 <complexType name=
"ContentType">
206 <!-- corresponds to slot role_name -->
207 <element name=
"role" type=
"mw:SlotRoleType" />
208 <!-- corresponds to slot origin -->
209 <element name=
"origin" type=
"positiveInteger" />
210 <element name=
"model" type=
"mw:ContentModelType" />
211 <element name=
"format" type=
"mw:ContentFormatType" />
212 <element name=
"text" type=
"mw:ContentTextType" />
216 <simpleType name=
"SlotRoleType">
217 <restriction base=
"string">
218 <pattern value=
"[a-zA-Z][-+./a-zA-Z0-9]*" />
222 <complexType name=
"ContentTextType">
224 <extension base=
"string">
225 <attribute ref=
"xml:space" default=
"preserve" />
226 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
227 <attribute name=
"deleted" type=
"mw:DeletedFlagType" />
228 <attribute name=
"location" type=
"anyURI" />
229 <attribute name=
"sha1" type=
"string" />
230 <attribute name=
"bytes" type=
"nonNegativeInteger" />
235 <complexType name=
"LogItemType">
237 <element name=
"id" type=
"positiveInteger" />
238 <element name=
"timestamp" type=
"dateTime" />
239 <element name=
"contributor" type=
"mw:ContributorType" />
240 <element name=
"comment" type=
"mw:CommentType" minOccurs=
"0" />
241 <element name=
"type" type=
"string" />
242 <element name=
"action" type=
"string" />
243 <element name=
"text" type=
"mw:LogTextType" minOccurs=
"0" maxOccurs=
"1" />
244 <element name=
"logtitle" type=
"string" minOccurs=
"0" maxOccurs=
"1" />
245 <element name=
"params" type=
"mw:LogParamsType" minOccurs=
"0" maxOccurs=
"1" />
249 <complexType name=
"CommentType">
251 <extension base=
"string">
252 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
253 <attribute name=
"deleted" type=
"mw:DeletedFlagType" />
258 <complexType name=
"TextType">
260 <extension base=
"string">
261 <attribute ref=
"xml:space" default=
"preserve" />
262 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
263 <attribute name=
"deleted" type=
"mw:DeletedFlagType" />
264 <!-- This isn't a good idea; we should be using "ID" instead of "NMTOKEN" -->
265 <!-- However, "NMTOKEN" is strictest definition that is both compatible with existing -->
266 <!-- usage ([0-9]+) and with the "ID" type. -->
267 <attribute name=
"id" type=
"NMTOKEN" />
268 <attribute name=
"location" type=
"anyURI" />
269 <attribute name=
"sha1" type=
"string"/>
270 <attribute name=
"bytes" type=
"nonNegativeInteger" />
275 <complexType name=
"LogTextType">
277 <extension base=
"string">
278 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
279 <attribute name=
"deleted" type=
"mw:DeletedFlagType" />
284 <complexType name=
"LogParamsType">
286 <extension base=
"string">
287 <attribute ref=
"xml:space" default=
"preserve" />
292 <complexType name=
"ContributorType">
294 <element name=
"username" type=
"string" minOccurs=
"0" />
295 <element name=
"id" type=
"nonNegativeInteger" minOccurs=
"0" />
297 <element name=
"ip" type=
"string" minOccurs=
"0" />
299 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
300 <attribute name=
"deleted" type=
"mw:DeletedFlagType" />
303 <complexType name=
"UploadType">
305 <!-- Revision-style data... -->
306 <element name=
"timestamp" type=
"dateTime" />
307 <element name=
"contributor" type=
"mw:ContributorType" />
308 <element name=
"comment" type=
"string" minOccurs=
"0" />
310 <!-- Filename. (Using underscores, not spaces. No 'File:' namespace marker.) -->
311 <element name=
"filename" type=
"string" />
313 <!-- URI at which this resource can be obtained -->
314 <element name=
"src" type=
"anyURI" />
316 <element name=
"size" type=
"positiveInteger" />
318 <!-- TODO: add other metadata fields -->
322 <!-- Discussion threading data for LiquidThreads -->
323 <complexType name=
"DiscussionThreadingInfo">
325 <element name=
"ThreadSubject" type=
"string" />
326 <element name=
"ThreadParent" type=
"positiveInteger" />
327 <element name=
"ThreadAncestor" type=
"positiveInteger" />
328 <element name=
"ThreadPage" type=
"string" />
329 <element name=
"ThreadID" type=
"positiveInteger" />
330 <element name=
"ThreadAuthor" type=
"string" />
331 <element name=
"ThreadEditStatus" type=
"string" />
332 <element name=
"ThreadType" type=
"string" />