export-0.7.xsd 9.2 KB

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