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.
26 The canonical URL to the schema document is:
27 http://www.mediawiki.org/xml/export-0.7.xsd
30 http://www.mediawiki.org/xml/export-0.7/
32 <schema xmlns="http://www.w3.org/2001/XMLSchema"
33 xmlns:mw="http://www.mediawiki.org/xml/export-0.7/"
34 targetNamespace="http://www.mediawiki.org/xml/export-0.7/"
35 elementFormDefault="qualified">
38 <documentation xml:lang="en">
39 MediaWiki's page export format
43 <!-- Need this to reference xml:lang -->
44 <import namespace="http://www.w3.org/XML/1998/namespace"
45 schemaLocation="http://www.w3.org/2001/xml.xsd" />
47 <!-- Our root element -->
48 <element name="mediawiki" type="mw:MediaWikiType">
49 <!-- Page ID contraint, see bug 4220 -->
50 <unique name="PageIDConstraint">
51 <selector xpath="mw:page" />
52 <field xpath="mw:id" />
54 <!-- Revision ID contraint, see bug 4220 -->
55 <unique name="RevIDConstraint">
56 <selector xpath="mw:page/mw:revision" />
57 <field xpath="mw:id" />
61 <complexType name="MediaWikiType">
63 <element name="siteinfo" type="mw:SiteInfoType"
64 minOccurs="0" maxOccurs="1" />
65 <element name="page" type="mw:PageType"
66 minOccurs="0" maxOccurs="unbounded" />
67 <element name="logitem" type="mw:LogItemType"
68 minOccurs="0" maxOccurs="unbounded" />
70 <attribute name="version" type="string" use="required" />
71 <attribute ref="xml:lang" use="required" />
74 <complexType name="SiteInfoType">
76 <element name="sitename" type="string" minOccurs="0" />
77 <element name="base" type="anyURI" minOccurs="0" />
78 <element name="generator" type="string" minOccurs="0" />
79 <element name="case" type="mw:CaseType" minOccurs="0" />
80 <element name="namespaces" type="mw:NamespacesType" minOccurs="0" />
84 <simpleType name="CaseType">
85 <restriction base="NMTOKEN">
86 <!-- Cannot have two titles differing only by case of first letter. -->
87 <!-- Default behavior through 1.5, $wgCapitalLinks = true -->
88 <enumeration value="first-letter" />
90 <!-- Complete title is case-sensitive -->
91 <!-- Behavior when $wgCapitalLinks = false -->
92 <enumeration value="case-sensitive" />
94 <!-- Cannot have non-case senstitive titles eg [[FOO]] == [[Foo]] -->
95 <!-- Not yet implemented as of MediaWiki 1.18 -->
96 <enumeration value="case-insensitive" />
100 <simpleType name="DeletedFlagType">
101 <restriction base="NMTOKEN">
102 <enumeration value="deleted" />
106 <complexType name="NamespacesType">
108 <element name="namespace" type="mw:NamespaceType"
109 minOccurs="0" maxOccurs="unbounded" />
113 <complexType name="NamespaceType">
115 <extension base="string">
116 <attribute name="key" type="integer" />
117 <attribute name="case" type="mw:CaseType" />
122 <complexType name="RedirectType">
124 <extension base="string">
125 <attribute name="title" type="string" />
130 <complexType name="PageType">
132 <!-- Title in text form. (Using spaces, not underscores; with namespace ) -->
133 <element name="title" type="string" />
135 <!-- Namespace in canonical form -->
136 <element name="ns" type="nonNegativeInteger" />
138 <!-- optional page ID number -->
139 <element name="id" type="positiveInteger" />
141 <!-- flag if the current revision is a redirect -->
142 <element name="redirect" type="mw:RedirectType" minOccurs="0" maxOccurs="1" />
144 <!-- comma-separated list of string tokens, if present -->
145 <element name="restrictions" type="string" minOccurs="0" />
147 <!-- Zero or more sets of revision or upload data -->
148 <choice minOccurs="0" maxOccurs="unbounded">
149 <element name="revision" type="mw:RevisionType" />
150 <element name="upload" type="mw:UploadType" />
153 <!-- Zero or One sets of discussion threading data -->
154 <element name="discussionthreadinginfo" minOccurs="0" maxOccurs="1" type="mw:DiscussionThreadingInfo" />
158 <complexType name="RevisionType">
160 <element name="id" type="positiveInteger" minOccurs="0" />
161 <element name="timestamp" type="dateTime" />
162 <element name="contributor" type="mw:ContributorType" />
163 <element name="minor" minOccurs="0" maxOccurs="1" />
164 <element name="comment" type="mw:CommentType" minOccurs="0" maxOccurs="1" />
165 <element name="sha1" type="string" />
166 <element name="text" type="mw:TextType" />
170 <complexType name="LogItemType">
172 <element name="id" type="positiveInteger" />
173 <element name="timestamp" type="dateTime" />
174 <element name="contributor" type="mw:ContributorType" />
175 <element name="comment" type="mw:CommentType" minOccurs="0" />
176 <element name="type" type="string" />
177 <element name="action" type="string" />
178 <element name="text" type="mw:LogTextType" minOccurs="0" maxOccurs="1" />
179 <element name="logtitle" type="string" minOccurs="0" maxOccurs="1" />
180 <element name="params" type="mw:LogParamsType" minOccurs="0" maxOccurs="1" />
184 <complexType name="CommentType">
186 <extension base="string">
187 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
188 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
193 <complexType name="TextType">
195 <extension base="string">
196 <attribute ref="xml:space" use="optional" default="preserve" />
197 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
198 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
199 <!-- This isn't a good idea; we should be using "ID" instead of "NMTOKEN" -->
200 <!-- However, "NMTOKEN" is strictest definition that is both compatible with existing -->
201 <!-- usage ([0-9]+) and with the "ID" type. -->
202 <attribute name="id" type="NMTOKEN" />
203 <attribute name="bytes" use="optional" type="nonNegativeInteger" />
208 <complexType name="LogTextType">
210 <extension base="string">
211 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
212 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
217 <complexType name="LogParamsType">
219 <extension base="string">
220 <attribute ref="xml:space" use="optional" default="preserve" />
225 <complexType name="ContributorType">
227 <element name="username" type="string" minOccurs="0" />
228 <element name="id" type="positiveInteger" minOccurs="0" />
230 <element name="ip" type="string" minOccurs="0" />
232 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
233 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
236 <complexType name="UploadType">
238 <!-- Revision-style data... -->
239 <element name="timestamp" type="dateTime" />
240 <element name="contributor" type="mw:ContributorType" />
241 <element name="comment" type="string" minOccurs="0" />
243 <!-- Filename. (Using underscores, not spaces. No 'File:' namespace marker.) -->
244 <element name="filename" type="string" />
246 <!-- URI at which this resource can be obtained -->
247 <element name="src" type="anyURI" />
249 <element name="size" type="positiveInteger" />
251 <!-- TODO: add other metadata fields -->
255 <!-- Discussion threading data for LiquidThreads -->
256 <complexType name="DiscussionThreadingInfo">
258 <element name="ThreadSubject" type="string" />
259 <element name="ThreadParent" type="positiveInteger" />
260 <element name="ThreadAncestor" type="positiveInteger" />
261 <element name="ThreadPage" type="string" />
262 <element name="ThreadID" type="positiveInteger" />
263 <element name="ThreadAuthor" type="string" />
264 <element name="ThreadEditStatus" type="string" />
265 <element name="ThreadType" type="string" />