export-0.10.xsd 9.9 KB

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