export-0.8.xsd 9.7 KB

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