Merge "(bug 22750) <logitem> is at wrong location in export.xsd"
[lhc/web/wiklou.git] / docs / export-0.7.xsd
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.
5
6 Version 0.2 adds optional basic file upload info support,
7 which is used by our OAI export/import submodule.
8
9 Version 0.3 adds some site configuration information such
10 as a list of defined namespaces.
11
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.
15
16 Version 0.5 adds byte count per revision.
17
18 Version 0.6 adds a separate namespace tag, and resolves the
19 redirect target and adds a separate sha1 tag for each revision.
20
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
26 The canonical URL to the schema document is:
27 http://www.mediawiki.org/xml/export-0.7.xsd
28
29 Use the namespace:
30 http://www.mediawiki.org/xml/export-0.7/
31 -->
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">
36
37 <annotation>
38 <documentation xml:lang="en">
39 MediaWiki's page export format
40 </documentation>
41 </annotation>
42
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"/>
46
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"/>
53 </unique>
54 <!-- Revision ID contraint, see bug 4220 -->
55 <unique name="RevIDConstraint">
56 <selector xpath="mw:page/mw:revision"/>
57 <field xpath="mw:id"/>
58 </unique>
59 </element>
60
61 <complexType name="MediaWikiType">
62 <sequence>
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"/>
69 </sequence>
70 <attribute name="version" type="string" use="required"/>
71 <attribute ref="xml:lang" use="required"/>
72 </complexType>
73
74 <complexType name="SiteInfoType">
75 <sequence>
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" />
81 </sequence>
82 </complexType>
83
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" />
89
90 <!-- Complete title is case-sensitive -->
91 <!-- Behavior when $wgCapitalLinks = false -->
92 <enumeration value="case-sensitive" />
93
94 <!-- Cannot have non-case senstitive titles eg [[FOO]] == [[Foo]] -->
95 <!-- Not yet implemented as of MediaWiki 1.18 -->
96 <enumeration value="case-insensitive" />
97 </restriction>
98 </simpleType>
99
100 <simpleType name="DeletedFlagType">
101 <restriction base="NMTOKEN">
102 <enumeration value="deleted"/>
103 </restriction>
104 </simpleType>
105
106 <complexType name="NamespacesType">
107 <sequence>
108 <element name="namespace" type="mw:NamespaceType"
109 minOccurs="0" maxOccurs="unbounded" />
110 </sequence>
111 </complexType>
112
113 <complexType name="NamespaceType">
114 <simpleContent>
115 <extension base="string">
116 <attribute name="key" type="integer" />
117 <attribute name="case" type="mw:CaseType" />
118 </extension>
119 </simpleContent>
120 </complexType>
121
122 <complexType name="PageType">
123 <sequence>
124 <!-- Title in text form. (Using spaces, not underscores; with namespace ) -->
125 <element name="title" type="string"/>
126
127 <!-- Namespace in canonical form -->
128 <element name="ns" type="nonNegativeInteger"/>
129
130 <!-- optional page ID number -->
131 <element name="id" type="positiveInteger" minOccurs="0"/>
132
133 <!-- flag if the current revision is a redirect -->
134 <element name="redirect" type="string" minOccurs="0"/>
135
136 <!-- comma-separated list of string tokens, if present -->
137 <element name="restrictions" type="string" minOccurs="0"/>
138
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" />
143 </choice>
144
145 <!-- Zero or One sets of discussion threading data -->
146 <element name="discussionthreadinginfo" minOccurs="0" maxOccurs="1" type="mw:DiscussionThreadingInfo" />
147 </sequence>
148 </complexType>
149
150 <complexType name="RevisionType">
151 <sequence>
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" />
159 </sequence>
160 </complexType>
161
162 <complexType name="LogItemType">
163 <sequence>
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" />
173 </sequence>
174 </complexType>
175
176 <complexType name="CommentType">
177 <simpleContent>
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"/>
181 </extension>
182 </simpleContent>
183 </complexType>
184
185 <complexType name="TextType">
186 <simpleContent>
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"/>
196 </extension>
197 </simpleContent>
198 </complexType>
199
200 <complexType name="LogTextType">
201 <simpleContent>
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"/>
205 </extension>
206 </simpleContent>
207 </complexType>
208
209 <complexType name="LogParamsType">
210 <simpleContent>
211 <extension base="string">
212 <attribute ref="xml:space" use="optional" default="preserve" />
213 </extension>
214 </simpleContent>
215 </complexType>
216
217 <complexType name="ContributorType">
218 <sequence>
219 <element name="username" type="string" minOccurs="0"/>
220 <element name="id" type="positiveInteger" minOccurs="0" />
221
222 <element name="ip" type="string" minOccurs="0"/>
223 </sequence>
224 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
225 <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/>
226 </complexType>
227
228 <complexType name="UploadType">
229 <sequence>
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"/>
234
235 <!-- Filename. (Using underscores, not spaces. No 'File:' namespace marker.) -->
236 <element name="filename" type="string"/>
237
238 <!-- URI at which this resource can be obtained -->
239 <element name="src" type="anyURI"/>
240
241 <element name="size" type="positiveInteger" />
242
243 <!-- TODO: add other metadata fields -->
244 </sequence>
245 </complexType>
246
247 <!-- Discussion threading data for LiquidThreads -->
248 <complexType name="DiscussionThreadingInfo">
249 <sequence>
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" />
258 </sequence>
259 </complexType>
260
261 </schema>