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 The canonical URL to the schema document is: 22 http://www.mediawiki.org/xml/export-0.6.xsd 23 24 Use the namespace: 25 http://www.mediawiki.org/xml/export-0.6/ 26--> 27<schema xmlns="http://www.w3.org/2001/XMLSchema" 28 xmlns:mw="http://www.mediawiki.org/xml/export-0.6/" 29 targetNamespace="http://www.mediawiki.org/xml/export-0.6/" 30 elementFormDefault="qualified"> 31 32 <annotation> 33 <documentation xml:lang="en"> 34 MediaWiki's page export format 35 </documentation> 36 </annotation> 37 38 <!-- Need this to reference xml:lang --> 39 <import namespace="http://www.w3.org/XML/1998/namespace" 40 schemaLocation="http://www.w3.org/2001/xml.xsd"/> 41 42 <!-- Our root element --> 43 <element name="mediawiki" type="mw:MediaWikiType"/> 44 45 <complexType name="MediaWikiType"> 46 <sequence> 47 <element name="siteinfo" type="mw:SiteInfoType" 48 minOccurs="0" maxOccurs="1"/> 49 <element name="page" type="mw:PageType" 50 minOccurs="0" maxOccurs="unbounded"/> 51 </sequence> 52 <attribute name="version" type="string" use="required"/> 53 <attribute ref="xml:lang" use="required"/> 54 </complexType> 55 56 <complexType name="SiteInfoType"> 57 <sequence> 58 <element name="sitename" type="string" minOccurs="0" /> 59 <element name="base" type="anyURI" minOccurs="0" /> 60 <element name="generator" type="string" minOccurs="0" /> 61 <element name="case" type="mw:CaseType" minOccurs="0" /> 62 <element name="namespaces" type="mw:NamespacesType" minOccurs="0" /> 63 </sequence> 64 </complexType> 65 66 <simpleType name="CaseType"> 67 <restriction base="NMTOKEN"> 68 <!-- Cannot have two titles differing only by case of first letter. --> 69 <!-- Default behavior through 1.5, $wgCapitalLinks = true --> 70 <enumeration value="first-letter" /> 71 72 <!-- Complete title is case-sensitive --> 73 <!-- Behavior when $wgCapitalLinks = false --> 74 <enumeration value="case-sensitive" /> 75 76 <!-- Cannot have non-case senstitive titles eg [[FOO]] == [[Foo]] --> 77 <!-- Not yet implemented as of MediaWiki 1.18 --> 78 <enumeration value="case-insensitive" /> 79 </restriction> 80 </simpleType> 81 82 <simpleType name="DeletedFlagType"> 83 <restriction base="NMTOKEN"> 84 <enumeration value="deleted"/> 85 </restriction> 86 </simpleType> 87 88 <complexType name="NamespacesType"> 89 <sequence> 90 <element name="namespace" type="mw:NamespaceType" 91 minOccurs="0" maxOccurs="unbounded" /> 92 </sequence> 93 </complexType> 94 95 <complexType name="NamespaceType"> 96 <simpleContent> 97 <extension base="string"> 98 <attribute name="key" type="integer" /> 99 <attribute name="case" type="mw:CaseType" /> 100 </extension> 101 </simpleContent> 102 </complexType> 103 104 <complexType name="PageType"> 105 <sequence> 106 <!-- Title in text form. (Using spaces, not underscores; with namespace ) --> 107 <element name="title" type="string"/> 108 109 <!-- Namespace in canonical form --> 110 <element name="ns" type="string"/> 111 112 <!-- optional page ID number --> 113 <element name="id" type="positiveInteger" minOccurs="0"/> 114 115 <element name="sha1" type="string"/> 116 117 <!-- flag if the current revision is a redirect --> 118 <element name="redirect" type="string" minOccurs="0"/> 119 120 <!-- comma-separated list of string tokens, if present --> 121 <element name="restrictions" type="string" minOccurs="0"/> 122 123 <!-- Zero or more sets of revision or upload data --> 124 <choice minOccurs="0" maxOccurs="unbounded"> 125 <element name="revision" type="mw:RevisionType" /> 126 <element name="upload" type="mw:UploadType" /> 127 <element name="logitem" type="mw:LogItemType" /> 128 </choice> 129 130 <!-- Zero or One sets of discussion threading data --> 131 <element name="discussionthreadinginfo" minOccurs="0" maxOccurs="1" type="mw:DiscussionThreadingInfo" /> 132 </sequence> 133 </complexType> 134 135 <complexType name="RevisionType"> 136 <sequence> 137 <element name="id" type="positiveInteger" minOccurs="0"/> 138 <element name="timestamp" type="dateTime"/> 139 <element name="contributor" type="mw:ContributorType"/> 140 <element name="minor" minOccurs="0" /> 141 <element name="comment" type="mw:CommentType" minOccurs="0"/> 142 <element name="text" type="mw:TextType" /> 143 </sequence> 144 </complexType> 145 146 <complexType name="LogItemType"> 147 <sequence> 148 <element name="id" type="positiveInteger" minOccurs="0"/> 149 <element name="timestamp" type="dateTime"/> 150 <element name="contributor" type="mw:ContributorType"/> 151 <element name="comment" type="mw:CommentType" minOccurs="0"/> 152 <element name="type" type="string" /> 153 <element name="action" type="string" /> 154 <element name="text" type="mw:TextType" /> 155 </sequence> 156 </complexType> 157 158 <complexType name="CommentType"> 159 <simpleContent> 160 <extension base="string"> 161 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent --> 162 <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/> 163 </extension> 164 </simpleContent> 165 </complexType> 166 167 168 <complexType name="TextType"> 169 <simpleContent> 170 <extension base="string"> 171 <attribute ref="xml:space" use="optional" default="preserve" /> 172 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent --> 173 <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/> 174 <!-- This isn't a good idea; we should be using "ID" instead of "NMTOKEN" --> 175 <!-- However, "NMTOKEN" is strictest definition that is both compatible with existing --> 176 <!-- usage ([0-9]+) and with the "ID" type. --> 177 <attribute name="id" type="NMTOKEN"/> 178 <attribute name="bytes" use="optional" type="nonNegativeInteger"/> 179 </extension> 180 </simpleContent> 181 </complexType> 182 183 <complexType name="ContributorType"> 184 <sequence> 185 <element name="username" type="string" minOccurs="0"/> 186 <element name="id" type="positiveInteger" minOccurs="0" /> 187 188 <element name="ip" type="string" minOccurs="0"/> 189 </sequence> 190 <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent --> 191 <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/> 192 </complexType> 193 194 <complexType name="UploadType"> 195 <sequence> 196 <!-- Revision-style data... --> 197 <element name="timestamp" type="dateTime"/> 198 <element name="contributor" type="mw:ContributorType"/> 199 <element name="comment" type="string" minOccurs="0"/> 200 201 <!-- Filename. (Using underscores, not spaces. No 'Image:' namespace marker.) --> 202 <element name="filename" type="string"/> 203 204 <!-- URI at which this resource can be obtained --> 205 <element name="src" type="anyURI"/> 206 207 <element name="size" type="positiveInteger" /> 208 209 <!-- TODO: add other metadata fields --> 210 </sequence> 211 </complexType> 212 213 <!-- Discussion threading data for LiquidThreads --> 214 <complexType name="DiscussionThreadingInfo"> 215 <sequence> 216 <element name="ThreadSubject" type="string" /> 217 <element name="ThreadParent" type="positiveInteger" /> 218 <element name="ThreadAncestor" type="positiveInteger" /> 219 <element name="ThreadPage" type="string" /> 220 <element name="ThreadID" type="positiveInteger" /> 221 <element name="ThreadAuthor" type="string" /> 222 <element name="ThreadEditStatus" type="string" /> 223 <element name="ThreadType" type="string" /> 224 </sequence> 225 </complexType> 226 227</schema> 228