Help:Export

Wiki pages can be exported in a special XML format to import into another MediaWiki installation or use it elsewise for instance for analysing the content. See also Syndication feeds for exporting other information but pages and Help:Import on importing pages.

How to export
There are at least four ways to export pages:


 * Paste the name of the articles in the box in Special:Export or use.
 * There is a OAI-PMH-interface to regularly fetch pages that have been modified since a specific time. For wikimedia projects this interface is not publicly available. OAI-PMH contains a wrapper format around the actual exported articles.

By default only the current version of a page is included. Optionally you can get all versions with date, time, user name and edit summary.

Additionally you can copy the SQL database. This is how dumps of the database were made available before MediaWiki 1.5 and it won't be explained here further.

Using 'Special:Export'
To export all pages of a namespace, for example.

1. Get the names of pages to export

 * Go to Special:Allpages and choose the desired namespace.
 * Copy the list of page names to a text editor
 * Put all page names on separate lines
 * Prefix the namespace to the page names (e.g. 'Help:Contents'), unless the selected namespace is the main namespace.

2. Perform the export
and finally...
 * Go to Special:Export and paste all your page names into the textbox, making sure there are no empty lines.
 * Click 'Submit query'
 * Save the resulting XML to a file using your browser's save facility.
 * Open the XML file in a text editor. Scroll to the bottom to check for error messages.

Now you can use this XML file to perform an import.

Exporting the full history
A checkbox in the Special:Export interface selects whether to export the full history (all versions of an article) or the most recent version of articles. A maximum of 100 revisions are returned; other revisions can be requested as detailed in MW:Parameters to Special:Export.

Export format
The format of the XML file you receive is the same in all ways. It is supposed to be codified in XML Schema at http://www.mediawiki.org/xml/export-0.5.xsd but currently version 0.5 is not available. However versions 0.1 to 0.4 are. This format is not intended for viewing in a web browser. Some browsers show you pretty-printed XML with "+" and "-" links to view or hide selected parts. Alternatively the XML-source can be viewed using the "view source" feature of the browser, or after saving the XML file locally, with a program of choice. If you directly read the XML source it won't be difficult to find the actual wikitext. If you don't use a special XML editor "<" and ">" appear as &amp;lt; and &amp;gt;, to avoid a conflict with XML tags; to avoid ambiguity, "&amp;" is coded as "&amp;amp;".

In the current version the export format does not contain an XML replacement of wiki markup (see WikiQueer DTD for an older proposal, or Wiki Markup Language). You only get the wikitext as you get when editing the article. (After export you can use alternative parsers to convert wikitext to other format)

DTD
Here is an unofficial, short Document Type Definition version of the format. If you don't know what a DTD is just ignore it.

Processing XML export
There are undoubtedly many tools which can process the exported XML. If you process a large number of pages (for instance a whole dump) you probably won't be able to get the document in main memory so you will need a parser based on SAX or other event-driven methods.

You can also just use regular expressions to directly process parts of the XML code. This may be faster than other methods but not recommended because it's difficult to maintain.

Please list methods and tools for processing XML export here:


 * Processing MediaWiki XML with STX - Stream based XML transformation
 * The IBM History flow project can read it after applying a small Python program, export-historyflow-expand.py.

Details and practical advice
/mediawiki/siteinfo/namespaces/namespace
 * To determine the namespace of a page you have to match its title to the prefixed defined in
 * Possible restrictions are
 * sysop (protected pages)