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="PageType">
124 <!-- Title in text form. (Using spaces, not underscores; with namespace ) -->
125 <element name="title" type="string"/>
127 <!-- Namespace in canonical form -->
128 <element name="ns" type="nonNegativeInteger"/>
130 <!-- optional page ID number -->
131 <element name="id" type="positiveInteger" minOccurs="0"/>
133 <!-- flag if the current revision is a redirect -->
134 <element name="redirect" type="string" minOccurs="0"/>
136 <!-- comma-separated list of string tokens, if present -->
137 <element name="restrictions" type="string" minOccurs="0"/>
139 <!-- Zero or more sets of revision or upload data -->
140 <choice minOccurs="0" maxOccurs="unbounded">
141 <element name="revision" type="mw:RevisionType" />
142 <element name="upload" type="mw:UploadType" />
145 <!-- Zero or One sets of discussion threading data -->
146 <element name="discussionthreadinginfo" minOccurs="0" maxOccurs="1" type="mw:DiscussionThreadingInfo" />
150 <complexType name="RevisionType">
152 <element name="id" type="positiveInteger" minOccurs="0"/>
153 <element name="timestamp" type="dateTime"/>
154 <element name="contributor" type="mw:ContributorType"/>
155 <element name="minor" minOccurs="0" />
156 <element name="comment" type="mw:CommentType" minOccurs="0"/>
157 <element name="sha1" type="string" />
158 <element name="text" type="mw:TextType" />
162 <complexType name="LogItemType">
164 <element name="id" type="positiveInteger" minOccurs="0"/>
165 <element name="timestamp" type="dateTime"/>
166 <element name="contributor" type="mw:ContributorType"/>
167 <element name="comment" type="mw:CommentType" minOccurs="0"/>
168 <element name="type" type="string" />
169 <element name="action" type="string" />
170 <element name="text" type="mw:LogTextType" minOccurs="0" maxOccurs="1" />
171 <element name="logtitle" type="string" minOccurs="0" maxOccurs="1" />
172 <element name="params" type="mw:LogParamsType" minOccurs="0" maxOccurs="1" />
176 <complexType name="CommentType">
178 <extension base="string">
179 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
180 <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/>
185 <complexType name="TextType">
187 <extension base="string">
188 <attribute ref="xml:space" use="optional" default="preserve" />
189 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
190 <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/>
191 <!-- This isn't a good idea; we should be using "ID" instead of "NMTOKEN" -->
192 <!-- However, "NMTOKEN" is strictest definition that is both compatible with existing -->
193 <!-- usage ([0-9]+) and with the "ID" type. -->
194 <attribute name="id" type="NMTOKEN"/>
195 <attribute name="bytes" use="optional" type="nonNegativeInteger"/>
200 <complexType name="LogTextType">
202 <extension base="string">
203 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
204 <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/>
209 <complexType name="LogParamsType">
211 <extension base="string">
212 <attribute ref="xml:space" use="optional" default="preserve" />
217 <complexType name="ContributorType">
219 <element name="username" type="string" minOccurs="0"/>
220 <element name="id" type="positiveInteger" minOccurs="0" />
222 <element name="ip" type="string" minOccurs="0"/>
224 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
225 <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/>
228 <complexType name="UploadType">
230 <!-- Revision-style data... -->
231 <element name="timestamp" type="dateTime"/>
232 <element name="contributor" type="mw:ContributorType"/>
233 <element name="comment" type="string" minOccurs="0"/>
235 <!-- Filename. (Using underscores, not spaces. No 'File:' namespace marker.) -->
236 <element name="filename" type="string"/>
238 <!-- URI at which this resource can be obtained -->
239 <element name="src" type="anyURI"/>
241 <element name="size" type="positiveInteger" />
243 <!-- TODO: add other metadata fields -->
247 <!-- Discussion threading data for LiquidThreads -->
248 <complexType name="DiscussionThreadingInfo">
250 <element name="ThreadSubject" type="string" />
251 <element name="ThreadParent" type="positiveInteger" />
252 <element name="ThreadAncestor" type="positiveInteger" />
253 <element name="ThreadPage" type="string" />
254 <element name="ThreadID" type="positiveInteger" />
255 <element name="ThreadAuthor" type="string" />
256 <element name="ThreadEditStatus" type="string" />
257 <element name="ThreadType" type="string" />