export-0.9.xsd 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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. Version 0.2 adds optional basic file upload info support,
  6. which is used by our OAI export/import submodule.
  7. Version 0.3 adds some site configuration information such
  8. as a list of defined namespaces.
  9. Version 0.4 adds per-revision delete flags, log exports,
  10. discussion threading data, a per-page redirect flag, and
  11. per-namespace capitalization.
  12. Version 0.5 adds byte count per revision.
  13. Version 0.6 adds a separate namespace tag, and resolves the
  14. redirect target and adds a separate sha1 tag for each revision.
  15. Version 0.7 adds a unique identity constraint for both page and
  16. revision identifiers. See also bug 4220.
  17. Fix type for <ns> from "positiveInteger" to "nonNegativeInteger" to allow 0
  18. Moves <logitem> to its right location.
  19. Add parentid to revision.
  20. Fix type for <id> within <contributor> to "nonNegativeInteger"
  21. Version 0.8 adds support for a <model> and a <format> tag for
  22. each revision. See contenthandler.txt.
  23. Version 0.9 adds the database name to the site information.
  24. The canonical URL to the schema document is:
  25. http://www.mediawiki.org/xml/export-0.9.xsd
  26. Use the namespace:
  27. http://www.mediawiki.org/xml/export-0.9/
  28. -->
  29. <schema xmlns="http://www.w3.org/2001/XMLSchema"
  30. xmlns:mw="http://www.mediawiki.org/xml/export-0.9/"
  31. targetNamespace="http://www.mediawiki.org/xml/export-0.9/"
  32. elementFormDefault="qualified">
  33. <annotation>
  34. <documentation xml:lang="en">
  35. MediaWiki's page export format
  36. </documentation>
  37. </annotation>
  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. <!-- Our root element -->
  42. <element name="mediawiki" type="mw:MediaWikiType">
  43. <!-- Page ID contraint, see bug 4220 -->
  44. <unique name="PageIDConstraint">
  45. <selector xpath="mw:page" />
  46. <field xpath="mw:id" />
  47. </unique>
  48. <!-- Revision ID contraint, see bug 4220 -->
  49. <unique name="RevIDConstraint">
  50. <selector xpath="mw:page/mw:revision" />
  51. <field xpath="mw:id" />
  52. </unique>
  53. </element>
  54. <complexType name="MediaWikiType">
  55. <sequence>
  56. <element name="siteinfo" type="mw:SiteInfoType"
  57. minOccurs="0" maxOccurs="1" />
  58. <element name="page" type="mw:PageType"
  59. minOccurs="0" maxOccurs="unbounded" />
  60. <element name="logitem" type="mw:LogItemType"
  61. minOccurs="0" maxOccurs="unbounded" />
  62. </sequence>
  63. <attribute name="version" type="string" use="required" />
  64. <attribute ref="xml:lang" use="required" />
  65. </complexType>
  66. <complexType name="SiteInfoType">
  67. <sequence>
  68. <element name="sitename" type="string" minOccurs="0" />
  69. <element name="dbname" type="string" minOccurs="0" />
  70. <element name="base" type="anyURI" minOccurs="0" />
  71. <element name="generator" type="string" minOccurs="0" />
  72. <element name="case" type="mw:CaseType" minOccurs="0" />
  73. <element name="namespaces" type="mw:NamespacesType" minOccurs="0" />
  74. </sequence>
  75. </complexType>
  76. <simpleType name="CaseType">
  77. <restriction base="NMTOKEN">
  78. <!-- Cannot have two titles differing only by case of first letter. -->
  79. <!-- Default behavior through 1.5, $wgCapitalLinks = true -->
  80. <enumeration value="first-letter" />
  81. <!-- Complete title is case-sensitive -->
  82. <!-- Behavior when $wgCapitalLinks = false -->
  83. <enumeration value="case-sensitive" />
  84. <!-- Cannot have non-case senstitive titles eg [[FOO]] == [[Foo]] -->
  85. <!-- Not yet implemented as of MediaWiki 1.18 -->
  86. <enumeration value="case-insensitive" />
  87. </restriction>
  88. </simpleType>
  89. <simpleType name="DeletedFlagType">
  90. <restriction base="NMTOKEN">
  91. <enumeration value="deleted" />
  92. </restriction>
  93. </simpleType>
  94. <complexType name="NamespacesType">
  95. <sequence>
  96. <element name="namespace" type="mw:NamespaceType"
  97. minOccurs="0" maxOccurs="unbounded" />
  98. </sequence>
  99. </complexType>
  100. <complexType name="NamespaceType">
  101. <simpleContent>
  102. <extension base="string">
  103. <attribute name="key" type="integer" />
  104. <attribute name="case" type="mw:CaseType" />
  105. </extension>
  106. </simpleContent>
  107. </complexType>
  108. <complexType name="RedirectType">
  109. <simpleContent>
  110. <extension base="string">
  111. <attribute name="title" type="string" />
  112. </extension>
  113. </simpleContent>
  114. </complexType>
  115. <simpleType name="ContentModelType">
  116. <restriction base="string">
  117. <pattern value="[a-zA-Z][-+./a-zA-Z0-9]*" />
  118. </restriction>
  119. </simpleType>
  120. <simpleType name="ContentFormatType">
  121. <restriction base="string">
  122. <pattern value="[a-zA-Z][-+.a-zA-Z0-9]*/[a-zA-Z][-+.a-zA-Z0-9]*" />
  123. </restriction>
  124. </simpleType>
  125. <complexType name="PageType">
  126. <sequence>
  127. <!-- Title in text form. (Using spaces, not underscores; with namespace ) -->
  128. <element name="title" type="string" />
  129. <!-- Namespace in canonical form -->
  130. <element name="ns" type="nonNegativeInteger" />
  131. <!-- optional page ID number -->
  132. <element name="id" type="positiveInteger" />
  133. <!-- flag if the current revision is a redirect -->
  134. <element name="redirect" type="mw:RedirectType" minOccurs="0" maxOccurs="1" />
  135. <!-- comma-separated list of string tokens, if present -->
  136. <element name="restrictions" type="string" minOccurs="0" />
  137. <!-- Zero or more sets of revision or upload data -->
  138. <choice minOccurs="0" maxOccurs="unbounded">
  139. <element name="revision" type="mw:RevisionType" />
  140. <element name="upload" type="mw:UploadType" />
  141. </choice>
  142. <!-- Zero or One sets of discussion threading data -->
  143. <element name="discussionthreadinginfo" minOccurs="0" maxOccurs="1" type="mw:DiscussionThreadingInfo" />
  144. </sequence>
  145. </complexType>
  146. <complexType name="RevisionType">
  147. <sequence>
  148. <element name="id" type="positiveInteger" />
  149. <element name="parentid" type="positiveInteger" minOccurs="0" />
  150. <element name="timestamp" type="dateTime" />
  151. <element name="contributor" type="mw:ContributorType" />
  152. <element name="minor" minOccurs="0" maxOccurs="1" />
  153. <element name="comment" type="mw:CommentType" minOccurs="0" maxOccurs="1" />
  154. <element name="text" type="mw:TextType" />
  155. <element name="sha1" type="string" />
  156. <element name="model" type="mw:ContentModelType" />
  157. <element name="format" type="mw:ContentFormatType" />
  158. </sequence>
  159. </complexType>
  160. <complexType name="LogItemType">
  161. <sequence>
  162. <element name="id" type="positiveInteger" />
  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:LogTextType" minOccurs="0" maxOccurs="1" />
  169. <element name="logtitle" type="string" minOccurs="0" maxOccurs="1" />
  170. <element name="params" type="mw:LogParamsType" minOccurs="0" maxOccurs="1" />
  171. </sequence>
  172. </complexType>
  173. <complexType name="CommentType">
  174. <simpleContent>
  175. <extension base="string">
  176. <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
  177. <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
  178. </extension>
  179. </simpleContent>
  180. </complexType>
  181. <complexType name="TextType">
  182. <simpleContent>
  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" />
  192. </extension>
  193. </simpleContent>
  194. </complexType>
  195. <complexType name="LogTextType">
  196. <simpleContent>
  197. <extension base="string">
  198. <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
  199. <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
  200. </extension>
  201. </simpleContent>
  202. </complexType>
  203. <complexType name="LogParamsType">
  204. <simpleContent>
  205. <extension base="string">
  206. <attribute ref="xml:space" use="optional" default="preserve" />
  207. </extension>
  208. </simpleContent>
  209. </complexType>
  210. <complexType name="ContributorType">
  211. <sequence>
  212. <element name="username" type="string" minOccurs="0" />
  213. <element name="id" type="nonNegativeInteger" minOccurs="0" />
  214. <element name="ip" type="string" minOccurs="0" />
  215. </sequence>
  216. <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
  217. <attribute name="deleted" use="optional" type="mw:DeletedFlagType" />
  218. </complexType>
  219. <complexType name="UploadType">
  220. <sequence>
  221. <!-- Revision-style data... -->
  222. <element name="timestamp" type="dateTime" />
  223. <element name="contributor" type="mw:ContributorType" />
  224. <element name="comment" type="string" minOccurs="0" />
  225. <!-- Filename. (Using underscores, not spaces. No 'File:' namespace marker.) -->
  226. <element name="filename" type="string" />
  227. <!-- URI at which this resource can be obtained -->
  228. <element name="src" type="anyURI" />
  229. <element name="size" type="positiveInteger" />
  230. <!-- TODO: add other metadata fields -->
  231. </sequence>
  232. </complexType>
  233. <!-- Discussion threading data for LiquidThreads -->
  234. <complexType name="DiscussionThreadingInfo">
  235. <sequence>
  236. <element name="ThreadSubject" type="string" />
  237. <element name="ThreadParent" type="positiveInteger" />
  238. <element name="ThreadAncestor" type="positiveInteger" />
  239. <element name="ThreadPage" type="string" />
  240. <element name="ThreadID" type="positiveInteger" />
  241. <element name="ThreadAuthor" type="string" />
  242. <element name="ThreadEditStatus" type="string" />
  243. <element name="ThreadType" type="string" />
  244. </sequence>
  245. </complexType>
  246. </schema>