XAR Format Specifications

Last modified by Eleni Cojocariu on 2026/03/19 08:02

Reference

A "XWiki Archive" (XAR) file is a ZIP file with extension ".xar" containing an (optional) "package.xml" descriptor file and in which each Page (including the Page's history, XObjects, attachments, XClasses, etc.) is in a XML file. This is the current format of the "package.xml" file:


<package>
  <infos>
    <name>Package Name</name>
    <description>A description of the package</description>
    <licence>Some License 2.0</licence>
    <author>XWiki.User</author>
    <extensionId>extension-id</extensionId>
    <version>1.0</version>
    <backupPack>false</backupPack>
    <preserveVersion>true</preserveVersion>
  </infos>
  <files>
    <file defaultAction="0" language="">News.WebHome</file>
    <file defaultAction="0" language="">News.Announcements.WebHome</file>
    <file defaultAction="0" language="">News.Updates.WebHome</file>
    <file defaultAction="0" language="">Welcome.WebHome</file>
    <file defaultAction="0" language="">Welcome.AboutOurCompany.WebHome</file>
    <file language="fr" defaultAction="0">Welcome.TranslatedPage</file>
  </files>
</package>
Package information and filesXML ElemetDescription
Information (infos)
nameThe name representing what's contained in the XAR.
descriptionMore detailed description of the content of the XAR.
licenceThis can be set to specify under which license this XAR content is published.
authorThe wiki author of this XAR. When the XAR is going to be imported, if the "import as backup pack" option is selected, the author mentioned in this field will be preserved (the Pages will have this author as their last author).
extensionId (optional)If set, then this marks the XAR as containing an Extension. Thus when you import the extension, the Extension Manager will be able to match it with its Extension database and perform versioning verifications.
preserveVersion(optional)If set to true, then the history is preserved (the history for each Page is part of its XML).
backupPackIf true, it means that the XAR is a backup pack. It's up to the import to decide whether to import it as a backup pack or not but this provides the information that it is a backup pack.
Files (files)
languageThe language of the Page. The default Page content should use an empty string.
typeThe type of the Page, it's possible to set any type since extensions can contribute new types. Standard Types.
 defaultActionThis attribute is deprecated, it is part of an older import mechanism and is no longer recommended for new packages. When it is applied (which is not very often), defaultAction defines the default behavior to use when importing a Page:
  • -1 (undefined): The exact behavior depends on the component that processes the package.
  • 0 (overwrite): The document in the database is overwritten by the one from the package. This is the default value used by the Maven XAR plugin when generating XAR files.
  • 1 (skip): The Page is not imported.
  • 2 (merge): The importer attempts to merge the packaged Page with the existing one in the database.
 The file element (e.g., "News.Announcements.WebHome") The file element is the Page reference

FAQ

How are the package information defined?

When exporting content in XAR format, there are some configuration settings allowing to set the name of the package, a description,  etc. In addition, there are some customizations done using some URL parameters

More

To find more about the current topic, you can search or use the table below and filter the columns to narrow your choices.

Related

Get Connected