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
25 The canonical URL to the schema document is:
26 http://www.mediawiki.org/xml/export-0.7.xsd
29 http://www.mediawiki.org/xml/export-0.7/
31 <schema xmlns="http://www.w3.org/2001/XMLSchema"
32 xmlns:mw="http://www.mediawiki.org/xml/export-0.7/"
33 targetNamespace="http://www.mediawiki.org/xml/export-0.7/"
34 elementFormDefault="qualified">
37 <documentation xml:lang="en">
38 MediaWiki's page export format
42 <!-- Need this to reference xml:lang -->
43 <import namespace="http://www.w3.org/XML/1998/namespace"
44 schemaLocation="http://www.w3.org/2001/xml.xsd"/>
46 <!-- Our root element -->
47 <element name="mediawiki" type="mw:MediaWikiType">
48 <!-- Page ID contraint, see bug 4220 -->
49 <unique name="PageIDConstraint">
50 <selector xpath="mw:page"/>
51 <field xpath="mw:id"/>
53 <!-- Revision ID contraint, see bug 4220 -->
54 <unique name="RevIDConstraint">
55 <selector xpath="mw:page/mw:revision"/>
56 <field xpath="mw:id"/>
60 <complexType name="MediaWikiType">
62 <element name="siteinfo" type="mw:SiteInfoType"
63 minOccurs="0" maxOccurs="1"/>
64 <element name="page" type="mw:PageType"
65 minOccurs="0" maxOccurs="unbounded"/>
67 <attribute name="version" type="string" use="required"/>
68 <attribute ref="xml:lang" use="required"/>
71 <complexType name="SiteInfoType">
73 <element name="sitename" type="string" minOccurs="0" />
74 <element name="base" type="anyURI" minOccurs="0" />
75 <element name="generator" type="string" minOccurs="0" />
76 <element name="case" type="mw:CaseType" minOccurs="0" />
77 <element name="namespaces" type="mw:NamespacesType" minOccurs="0" />
81 <simpleType name="CaseType">
82 <restriction base="NMTOKEN">
83 <!-- Cannot have two titles differing only by case of first letter. -->
84 <!-- Default behavior through 1.5, $wgCapitalLinks = true -->
85 <enumeration value="first-letter" />
87 <!-- Complete title is case-sensitive -->
88 <!-- Behavior when $wgCapitalLinks = false -->
89 <enumeration value="case-sensitive" />
91 <!-- Cannot have non-case senstitive titles eg [[FOO]] == [[Foo]] -->
92 <!-- Not yet implemented as of MediaWiki 1.18 -->
93 <enumeration value="case-insensitive" />
97 <simpleType name="DeletedFlagType">
98 <restriction base="NMTOKEN">
99 <enumeration value="deleted"/>
103 <complexType name="NamespacesType">
105 <element name="namespace" type="mw:NamespaceType"
106 minOccurs="0" maxOccurs="unbounded" />
110 <complexType name="NamespaceType">
112 <extension base="string">
113 <attribute name="key" type="integer" />
114 <attribute name="case" type="mw:CaseType" />
119 <complexType name="PageType">
121 <!-- Title in text form. (Using spaces, not underscores; with namespace ) -->
122 <element name="title" type="string"/>
124 <!-- Namespace in canonical form -->
125 <element name="ns" type="nonNegativeInteger"/>
127 <!-- optional page ID number -->
128 <element name="id" type="positiveInteger" minOccurs="0"/>
130 <!-- flag if the current revision is a redirect -->
131 <element name="redirect" type="string" minOccurs="0"/>
133 <!-- comma-separated list of string tokens, if present -->
134 <element name="restrictions" type="string" minOccurs="0"/>
136 <!-- Zero or more sets of revision or upload data -->
137 <choice minOccurs="0" maxOccurs="unbounded">
138 <element name="revision" type="mw:RevisionType" />
139 <element name="upload" type="mw:UploadType" />
140 <element name="logitem" type="mw:LogItemType" />
143 <!-- Zero or One sets of discussion threading data -->
144 <element name="discussionthreadinginfo" minOccurs="0" maxOccurs="1" type="mw:DiscussionThreadingInfo" />
148 <complexType name="RevisionType">
150 <element name="id" type="positiveInteger" minOccurs="0"/>
151 <element name="timestamp" type="dateTime"/>
152 <element name="contributor" type="mw:ContributorType"/>
153 <element name="minor" minOccurs="0" />
154 <element name="comment" type="mw:CommentType" minOccurs="0"/>
155 <element name="sha1" type="string" />
156 <element name="text" type="mw:TextType" />
160 <complexType name="LogItemType">
162 <element name="id" type="positiveInteger" minOccurs="0"/>
163 <element name="timestamp" type="dateTime"/>
164 <element name="contributor" type="mw:ContributorType"/>
165 <element name="comment" type="mw:CommentType" minOccurs="0"/>
166 <element name="type" type="string" />
167 <element name="action" type="string" />
168 <element name="text" type="mw:TextType" />
172 <complexType name="CommentType">
174 <extension base="string">
175 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
176 <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/>
181 <complexType name="TextType">
183 <extension base="string">
184 <attribute ref="xml:space" use="optional" default="preserve" />
185 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
186 <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/>
187 <!-- This isn't a good idea; we should be using "ID" instead of "NMTOKEN" -->
188 <!-- However, "NMTOKEN" is strictest definition that is both compatible with existing -->
189 <!-- usage ([0-9]+) and with the "ID" type. -->
190 <attribute name="id" type="NMTOKEN"/>
191 <attribute name="bytes" use="optional" type="nonNegativeInteger"/>
196 <complexType name="ContributorType">
198 <element name="username" type="string" minOccurs="0"/>
199 <element name="id" type="positiveInteger" minOccurs="0" />
201 <element name="ip" type="string" minOccurs="0"/>
203 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
204 <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/>
207 <complexType name="UploadType">
209 <!-- Revision-style data... -->
210 <element name="timestamp" type="dateTime"/>
211 <element name="contributor" type="mw:ContributorType"/>
212 <element name="comment" type="string" minOccurs="0"/>
214 <!-- Filename. (Using underscores, not spaces. No 'Image:' namespace marker.) -->
215 <element name="filename" type="string"/>
217 <!-- URI at which this resource can be obtained -->
218 <element name="src" type="anyURI"/>
220 <element name="size" type="positiveInteger" />
222 <!-- TODO: add other metadata fields -->
226 <!-- Discussion threading data for LiquidThreads -->
227 <complexType name="DiscussionThreadingInfo">
229 <element name="ThreadSubject" type="string" />
230 <element name="ThreadParent" type="positiveInteger" />
231 <element name="ThreadAncestor" type="positiveInteger" />
232 <element name="ThreadPage" type="string" />
233 <element name="ThreadID" type="positiveInteger" />
234 <element name="ThreadAuthor" type="string" />
235 <element name="ThreadEditStatus" type="string" />
236 <element name="ThreadType" type="string" />