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.txt.
31 Version 0.9 adds the database name to the site information.
33 The canonical URL to the schema document is:
34 http://www.mediawiki.org/xml/export-0.9.xsd
37 http://www.mediawiki.org/xml/export-0.9/
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">
45 <documentation xml:
lang=
"en">
46 MediaWiki's page export format
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" />
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" />
61 <!-- Revision ID contraint, see bug 4220 -->
62 <unique name=
"RevIDConstraint">
63 <selector xpath=
"mw:page/mw:revision" />
64 <field xpath=
"mw:id" />
68 <complexType name=
"MediaWikiType">
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" />
77 <attribute name=
"version" type=
"string" use=
"required" />
78 <attribute ref=
"xml:lang" use=
"required" />
81 <complexType name=
"SiteInfoType">
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" />
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" />
98 <!-- Complete title is case-sensitive -->
99 <!-- Behavior when $wgCapitalLinks = false -->
100 <enumeration value=
"case-sensitive" />
102 <!-- Cannot have non-case senstitive titles eg [[FOO]] == [[Foo]] -->
103 <!-- Not yet implemented as of MediaWiki 1.18 -->
104 <enumeration value=
"case-insensitive" />
108 <simpleType name=
"DeletedFlagType">
109 <restriction base=
"NMTOKEN">
110 <enumeration value=
"deleted" />
114 <complexType name=
"NamespacesType">
116 <element name=
"namespace" type=
"mw:NamespaceType"
117 minOccurs=
"0" maxOccurs=
"unbounded" />
121 <complexType name=
"NamespaceType">
123 <extension base=
"string">
124 <attribute name=
"key" type=
"integer" />
125 <attribute name=
"case" type=
"mw:CaseType" />
130 <complexType name=
"RedirectType">
132 <extension base=
"string">
133 <attribute name=
"title" type=
"string" />
138 <simpleType name=
"ContentModelType">
139 <restriction base=
"string">
140 <pattern value=
"[a-zA-Z][-+./a-zA-Z0-9]*" />
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]*" />
150 <complexType name=
"PageType">
152 <!-- Title in text form. (Using spaces, not underscores; with namespace ) -->
153 <element name=
"title" type=
"string" />
155 <!-- Namespace in canonical form -->
156 <element name=
"ns" type=
"nonNegativeInteger" />
158 <!-- optional page ID number -->
159 <element name=
"id" type=
"positiveInteger" />
161 <!-- flag if the current revision is a redirect -->
162 <element name=
"redirect" type=
"mw:RedirectType" minOccurs=
"0" maxOccurs=
"1" />
164 <!-- comma-separated list of string tokens, if present -->
165 <element name=
"restrictions" type=
"string" minOccurs=
"0" />
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" />
173 <!-- Zero or One sets of discussion threading data -->
174 <element name=
"discussionthreadinginfo" minOccurs=
"0" maxOccurs=
"1" type=
"mw:DiscussionThreadingInfo" />
178 <complexType name=
"RevisionType">
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" />
193 <complexType name=
"LogItemType">
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" />
207 <complexType name=
"CommentType">
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" />
216 <complexType name=
"TextType">
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" />
231 <complexType name=
"LogTextType">
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" />
240 <complexType name=
"LogParamsType">
242 <extension base=
"string">
243 <attribute ref=
"xml:space" use=
"optional" default=
"preserve" />
248 <complexType name=
"ContributorType">
250 <element name=
"username" type=
"string" minOccurs=
"0" />
251 <element name=
"id" type=
"nonNegativeInteger" minOccurs=
"0" />
253 <element name=
"ip" type=
"string" minOccurs=
"0" />
255 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
256 <attribute name=
"deleted" use=
"optional" type=
"mw:DeletedFlagType" />
259 <complexType name=
"UploadType">
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" />
266 <!-- Filename. (Using underscores, not spaces. No 'File:' namespace marker.) -->
267 <element name=
"filename" type=
"string" />
269 <!-- URI at which this resource can be obtained -->
270 <element name=
"src" type=
"anyURI" />
272 <element name=
"size" type=
"positiveInteger" />
274 <!-- TODO: add other metadata fields -->
278 <!-- Discussion threading data for LiquidThreads -->
279 <complexType name=
"DiscussionThreadingInfo">
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" />