XAR Format Specifications

Version 9.1 by Thomas Mortagne on 2015/07/15 16:04

A XAR file is a ZIP file with extension ".xar" containing a "package.xml" descriptor file and in which each document (including the document's history, xobjects, attachments, xclass, etc.) is in a XML file.

package.xml

<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>
 </infos>
 <files>
   <file language="" defaultAction="0">Space.Page</file>
   <file language="" defaultAction="0">Space.TranslatedPage</file>
   <file language="fr" defaultAction="0">Space.TranslatedPage</file>
 </files>
</package>
  • name: name representing what's contained in the XAR
  • description: more detailed description of the content of the XAR
  • license: can be set to specify under which license this XAR content is published
  • author: Wiki author of this XAR. This is important. When the XAR is going to be imported this is the author that it'll be imported with if the "import as backup pack" option is selected at import time
  • extensionId (optional): if set then this marks the XAR as containing an Extension. Thus when you import it, 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)
  • backupPack: if 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
    • language: the language of the page. The default page content should use an empty string.
    • defaultAction: This is unused.
    • The value inside the file element is the reference of the page, relative to the current wiki (i.e. Space.Page)

Document XML file

You can see the XML of a document by exporting it and opening the XAR or by using the xpage=xml parameter when on wiki page URL.

<xwikidoc version="1.2" reference="Space.Page" locale="">
 <web>Space</web>
 <name>Page</name>
 <language/>
 <defaultLanguage>en</defaultLanguage>
 <translation>0</translation>
 <creator>XWiki.creator</creator>
 <creationDate>946684800000</creationDate>
 <versions>jrcsrevisions</versions>
 <parent>parent</parent>
 <author>XWiki.author</author>
 <customClass>customclass</customClass>
 <contentAuthor>XWiki.contentAuthor</contentAuthor>
 <date>946771200000</date>
 <contentUpdateDate>946857600000</contentUpdateDate>
 <version>1.1</version>
 <title>title</title>
 <defaultTemplate>defaultTemplate</defaultTemplate>
 <validationScript>validationScript</validationScript>
 <comment>comment</comment>
 <minorEdit>false</minorEdit>
 <syntaxId>syntax/1.0</syntaxId>
 <hidden>true</hidden>
 <content>content</content>
 <renderedcontent/>
 <attachment>
   <filename>attachment.txt</filename>
   <versions>jrcsrevisions</versions>
   <author>XWiki.author</author>
   <date>947030400000</date>
   <version>1.1</version>
   <comment>comment</comment>
   <content>AAECAwQFBgcICQ==</content>
   <filesize>10</filesize>
 </attachment>
 <class>
   <name>Space.Page</name>
   <customClass>customClass</customClass>
   <customMapping>customMapping</customMapping>
   <defaultViewSheet>defaultViewSheet</defaultViewSheet>
   <defaultEditSheet>defaultEditSheet</defaultEditSheet>
   <defaultWeb>defaultWeb</defaultWeb>
   <nameField>nameField</nameField>
   <validationScript>validationScript</validationScript>
   <prop1>
     <disabled>0</disabled>
     <name>prop1</name>
     <number>1</number>
     <numberType>long</numberType>
     <prettyName>Prop1</prettyName>
     <size>30</size>
     <unmodifiable>0</unmodifiable>
     <classType>com.xpn.xwiki.objects.classes.NumberClass</classType>
   </prop1>
 </class>
 <object>
   <name>Space.Page</name>
   <number>0</number>
   <className>Space.Page</className>
   <guid>e2167721-2a64-430c-9520-bac1c0ee68cb</guid>
   <class>
     <name>Space.Page</name>
     <customClass>customClass</customClass>
     <customMapping>customMapping</customMapping>
     <defaultViewSheet>defaultViewSheet</defaultViewSheet>
     <defaultEditSheet>defaultEditSheet</defaultEditSheet>
     <defaultWeb>defaultWeb</defaultWeb>
     <nameField>nameField</nameField>
     <validationScript>validationScript</validationScript>
     <prop1>
       <disabled>0</disabled>
       <name>prop1</name>
       <number>1</number>
       <numberType>long</numberType>
       <prettyName>Prop1</prettyName>
       <size>30</size>
       <unmodifiable>0</unmodifiable>
       <classType>com.xpn.xwiki.objects.classes.NumberClass</classType>
     </prop1>
   </class>
   <property>
     <prop1>1</prop1>
   </property>
 </object>
 <object>
   <name>Space.Page</name>
   <number>0</number>
   <className>otherclass</className>
   <guid>8eaeac52-e2f2-47b2-87e1-bc6909597b39</guid>
   <class>
     <name>otherclass</name>
     <customClass>customClass2</customClass>
     <customMapping>customMapping2</customMapping>
     <defaultViewSheet>defaultViewSheet2</defaultViewSheet>
     <defaultEditSheet>defaultEditSheet2</defaultEditSheet>
     <defaultWeb>defaultWeb2</defaultWeb>
     <nameField>nameField2</nameField>
     <validationScript>validationScript2</validationScript>
     <prop2>
       <disabled>0</disabled>
       <name>prop2</name>
       <number>1</number>
       <numberType>long</numberType>
       <prettyName>Prop2</prettyName>
       <size>30</size>
       <unmodifiable>0</unmodifiable>
       <classType>com.xpn.xwiki.objects.classes.NumberClass</classType>
     </prop2>
   </class>
   <property>
     <prop2>2</prop2>
   </property>
 </object>
</xwikidoc>

TODO

Put some documentation for each element

Tags:
    

Get Connected