Non-word characters don't terminate tag names.
[mediawiki.git] / docs / export-0.8.xsd
blob07b432a19760c9d4a58b90eec828cb575029b444
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!--
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 The canonical URL to the schema document is:
32 http://www.mediawiki.org/xml/export-0.8.xsd
34 Use the namespace:
35 http://www.mediawiki.org/xml/export-0.8/
36 -->
37 <schema xmlns="http://www.w3.org/2001/XMLSchema"
38 xmlns:mw="http://www.mediawiki.org/xml/export-0.8/"
39 targetNamespace="http://www.mediawiki.org/xml/export-0.8/"
40 elementFormDefault="qualified">
42 <annotation>
43 <documentation xml:lang="en">
44 MediaWiki's page export format
45 </documentation>
46 </annotation>
48 <!-- Need this to reference xml:lang -->
49 <import namespace="http://www.w3.org/XML/1998/namespace"
50 schemaLocation="http://www.w3.org/2001/xml.xsd" />
52 <!-- Our root element -->
53 <element name="mediawiki" type="mw:MediaWikiType">
54 <!-- Page ID contraint, see bug 4220 -->
55 <unique name="PageIDConstraint">
56 <selector xpath="mw:page" />
57 <field xpath="mw:id" />
58 </unique>
59 <!-- Revision ID contraint, see bug 4220 -->
60 <unique name="RevIDConstraint">
61 <selector xpath="mw:page/mw:revision" />
62 <field xpath="mw:id" />
63 </unique>
64 </element>
66 <complexType name="MediaWikiType">
67 <sequence>
68 <element name="siteinfo" type="mw:SiteInfoType"
69 minOccurs="0" maxOccurs="1" />
70 <element name="page" type="mw:PageType"
71 minOccurs="0" maxOccurs="unbounded" />
72 <element name="logitem" type="mw:LogItemType"
73 minOccurs="0" maxOccurs="unbounded" />
74 </sequence>
75 <attribute name="version" type="string" use="required" />
76 <attribute ref="xml:lang" use="required" />
77 </complexType>
79 <complexType name="SiteInfoType">
80 <sequence>
81 <element name="sitename" type="string" minOccurs="0" />
82 <element name="base" type="anyURI" minOccurs="0" />
83 <element name="generator" type="string" minOccurs="0" />
84 <element name="case" type="mw:CaseType" minOccurs="0" />
85 <element name="namespaces" type="mw:NamespacesType" minOccurs="0" />
86 </sequence>
87 </complexType>
89 <simpleType name="CaseType">
90 <restriction base="NMTOKEN">
91 <!-- Cannot have two titles differing only by case of first letter. -->
92 <!-- Default behavior through 1.5, $wgCapitalLinks = true -->
93 <enumeration value="first-letter" />
95 <!-- Complete title is case-sensitive -->
96 <!-- Behavior when $wgCapitalLinks = false -->
97 <enumeration value="case-sensitive" />
99 <!-- Cannot have non-case senstitive titles eg [[FOO]] == [[Foo]] -->
100 <!-- Not yet implemented as of MediaWiki 1.18 -->
101 <enumeration value="case-insensitive" />
102 </restriction>
103 </simpleType>
105 <simpleType name="DeletedFlagType">
106 <restriction base="NMTOKEN">
107 <enumeration value="deleted" />
108 </restriction>
109 </simpleType>
111 <complexType name="NamespacesType">
112 <sequence>
113 <element name="namespace" type="mw:NamespaceType"
114 minOccurs="0" maxOccurs="unbounded" />
115 </sequence>
116 </complexType>
118 <complexType name="NamespaceType">
119 <simpleContent>
120 <extension base="string">
121 <attribute name="key" type="integer" />
122 <attribute name="case" type="mw:CaseType" />
123 </extension>
124 </simpleContent>
125 </complexType>
127 <complexType name="RedirectType">
128 <simpleContent>
129 <extension base="string">
130 <attribute name="title" type="string" />
131 </extension>
132 </simpleContent>
133 </complexType>
135 <simpleType name="ContentModelType">
136 <restriction base="string">
137 <pattern value="[a-zA-Z][-+./a-zA-Z0-9]*" />
138 </restriction>
139 </simpleType>
141 <simpleType name="ContentFormatType">
142 <restriction base="string">
143 <pattern value="[a-zA-Z][-+.a-zA-Z0-9]*/[a-zA-Z][-+.a-zA-Z0-9]*" />
144 </restriction>
145 </simpleType>
147 <complexType name="PageType">
148 <sequence>
149 <!-- Title in text form. (Using spaces, not underscores; with namespace ) -->
150 <element name="title" type="string" />
152 <!-- Namespace in canonical form -->
153 <element name="ns" type="nonNegativeInteger" />
155 <!-- optional page ID number -->
156 <element name="id" type="positiveInteger" />
158 <!-- flag if the current revision is a redirect -->
159 <element name="redirect" type="mw:RedirectType" minOccurs="0" maxOccurs="1" />
161 <!-- comma-separated list of string tokens, if present -->
162 <element name="restrictions" type="string" minOccurs="0" />
164 <!-- Zero or more sets of revision or upload data -->
165 <choice minOccurs="0" maxOccurs="unbounded">
166 <element name="revision" type="mw:RevisionType" />
167 <element name="upload" type="mw:UploadType" />
168 </choice>
170 <!-- Zero or One sets of discussion threading data -->
171 <element name="discussionthreadinginfo" minOccurs="0" maxOccurs="1" type="mw:DiscussionThreadingInfo" />
172 </sequence>
173 </complexType>
175 <complexType name="RevisionType">
176 <sequence>
177 <element name="id" type="positiveInteger" />
178 <element name="parentid" type="positiveInteger" minOccurs="0" />
179 <element name="timestamp" type="dateTime" />
180 <element name="contributor" type="mw:ContributorType" />
181 <element name="minor" minOccurs="0" maxOccurs="1" />
182 <element name="comment" type="mw:CommentType" minOccurs="0" maxOccurs="1" />
183 <element name="text" type="mw:TextType" />
184 <element name="sha1" type="string" />
185 <element name="model" type="mw:ContentModelType" />
186 <element name="format" type="mw:ContentFormatType" />
187 </sequence>
188 </complexType>
190 <complexType name="LogItemType">
191 <sequence>
192 <element name="id" type="positiveInteger" />
193 <element name="timestamp" type="dateTime" />
194 <element name="contributor" type="mw:ContributorType" />
195 <element name="comment" type="mw:CommentType" minOccurs="0" />
196 <element name="type" type="string" />
197 <element name="action" type="string" />
198 <element name="text" type="mw:LogTextType" minOccurs="0" maxOccurs="1" />
199 <element name="logtitle" type="string" minOccurs="0" maxOccurs="1" />
200 <element name="params" type="mw:LogParamsType" minOccurs="0" maxOccurs="1" />
201 </sequence>
202 </complexType>
204 <complexType name="CommentType">
205 <simpleContent>
206 <extension base="string">
207 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
208 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
209 </extension>
210 </simpleContent>
211 </complexType>
213 <complexType name="TextType">
214 <simpleContent>
215 <extension base="string">
216 <attribute ref="xml:space" use="optional" default="preserve" />
217 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
218 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
219 <!-- This isn't a good idea; we should be using "ID" instead of "NMTOKEN" -->
220 <!-- However, "NMTOKEN" is strictest definition that is both compatible with existing -->
221 <!-- usage ([0-9]+) and with the "ID" type. -->
222 <attribute name="id" type="NMTOKEN" />
223 <attribute name="bytes" use="optional" type="nonNegativeInteger" />
224 </extension>
225 </simpleContent>
226 </complexType>
228 <complexType name="LogTextType">
229 <simpleContent>
230 <extension base="string">
231 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
232 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
233 </extension>
234 </simpleContent>
235 </complexType>
237 <complexType name="LogParamsType">
238 <simpleContent>
239 <extension base="string">
240 <attribute ref="xml:space" use="optional" default="preserve" />
241 </extension>
242 </simpleContent>
243 </complexType>
245 <complexType name="ContributorType">
246 <sequence>
247 <element name="username" type="string" minOccurs="0" />
248 <element name="id" type="nonNegativeInteger" minOccurs="0" />
250 <element name="ip" type="string" minOccurs="0" />
251 </sequence>
252 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
253 <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
254 </complexType>
256 <complexType name="UploadType">
257 <sequence>
258 <!-- Revision-style data... -->
259 <element name="timestamp" type="dateTime" />
260 <element name="contributor" type="mw:ContributorType" />
261 <element name="comment" type="string" minOccurs="0" />
263 <!-- Filename. (Using underscores, not spaces. No 'File:' namespace marker.) -->
264 <element name="filename" type="string" />
266 <!-- URI at which this resource can be obtained -->
267 <element name="src" type="anyURI" />
269 <element name="size" type="positiveInteger" />
271 <!-- TODO: add other metadata fields -->
272 </sequence>
273 </complexType>
275 <!-- Discussion threading data for LiquidThreads -->
276 <complexType name="DiscussionThreadingInfo">
277 <sequence>
278 <element name="ThreadSubject" type="string" />
279 <element name="ThreadParent" type="positiveInteger" />
280 <element name="ThreadAncestor" type="positiveInteger" />
281 <element name="ThreadPage" type="string" />
282 <element name="ThreadID" type="positiveInteger" />
283 <element name="ThreadAuthor" type="string" />
284 <element name="ThreadEditStatus" type="string" />
285 <element name="ThreadType" type="string" />
286 </sequence>
287 </complexType>
289 </schema>