MediaWiki XML

Last modified by Thomas Mortagne on 2024/07/22 00:13

cogFilter stream extension to parse a MediaWiki XML package
Recommended
TypeJAR
CategoryFilter
Developed by

Thomas Mortagne

Active Installs67
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Compatibility

Requires XWiki 11.10 or more.

Installable with the Extension Manager

Description

Filter stream extension to parse a MediaWiki XML package

Supported input

XML export

The Filter take in input an XML file as defined in https://www.mediawiki.org/wiki/Help:Export#Export_format.

Files

The XML file contain the wiki pages, but MediaWiki also store files on the filesystem. You can directly use the folder in which MediaWiki store its files.

Import a MediaWiki export in an XWiki instance

prepareconvert.png

After you have completed these steps, click the "Convert" button. After that, you will see the conversion progress.

What about the MediaWiki templates ?

Calls to MediaWiki templates are converted into macro calls since that's the closest we can find in the XWiki world, but the implementation of those templates is not converted because it would be very hard (because they are implemented in PHP and often use MediaWiki APIs) so you end up with "Missing macro" error. To resolve them the simplest is to actually implement an XWiki macro which behave like the MediaWiki template you are trying to migrate, see https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/WritingMacros/ for more details on how to implement an XWiki macro.

Advanced use

Import everything in a specific wiki/space

By default, the importer try to convert as much as possible, MediaWiki naming into XWiki naming. That means that all the page located in default MediaWiki namespace will end up in XWiki Main space, for example.

If you make all the imported pages go in a specific wiki or space, you can use the property "Parent". Indicate the reference of the entity. For example for the wiki with the id mywiki use wiki:mywiki and for the space MediaWiki in wiki with id mywiki you can use space:mywiki:MediaWiki. It does not need to already exist.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.contrib.mediawiki:mediawiki-xml 2.1.0):

Get Connected