Wiki source code of XAR Format Specifications

Last modified by Thomas Mortagne on 2020/06/26 14:57

Show last authors
1 {{toc/}}
2
3 A XAR file is a ZIP file with extension ".xar" containing an (optional) "package.xml" descriptor file and in which each document (including the document's history, xobjects, attachments, xclass, etc.) is in a XML file.
4
5 = package.xml =
6
7 {{code language="xml"}}
8 <package>
9 <infos>
10 <name>Package Name</name>
11 <description>A description of the package</description>
12 <licence>Some License 2.0</licence>
13 <author>XWiki.User</author>
14 <extensionId>extension-id</extensionId>
15 <version>1.0</version>
16 <backupPack>false</backupPack>
17 </infos>
18 <files>
19 <file language="" defaultAction="0" type="home">Main.WebHome</file>
20 <file language="" defaultAction="0">Space.NestedSpace.Page</file>
21 <file language="" defaultAction="0">Space.TranslatedPage</file>
22 <file language="fr" defaultAction="0">Space.TranslatedPage</file>
23 </files>
24 </package>
25 {{/code}}
26
27 * ##name##: name representing what's contained in the XAR
28 * ##description##: more detailed description of the content of the XAR
29 * ##license##: can be set to specify under which license this XAR content is published
30 * ##author##: Wiki author of this XAR. This is important. 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).
31 * ##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.
32 * ##preserveVersion## (optional): if set to true then the history is preserved (the history for each page is part of its XML)
33 * ##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.
34 * ##files##
35 ** ##language##: the language of the page. The default page content should use an empty string.
36 ** ##type## {{info}}since [[1.1>>||anchor="H1.1"]]{{/info}}: the type of the document, it's possible to set any type since extensions can contribute new type. The standard types are the following:
37 *** ##default##: used to force the default. Edit and delete are not allowed and a 3-way merge is applied to the document during upgrades.
38 *** ##configuration##: a document containing configuration. Edit is allowed and the document is never upgraded.
39 *** ##demo##: a document which purpose is to provide demo data. Edit and delete are allowed and the document is upgraded only if it's not been customized.
40 *** ##customizable## (since XWiki 10.4): a document meant to be modified but not deleted. Edit is allowed and the document is upgraded only if it's not been customized.
41 ** ##defaultAction## {{warning}}deprecated{{/warning}}: when applied (which is not very often) this is the default action to apply on the document
42 *** ##-1##: undefined, its exact interpretation depends on what is reading it
43 *** ##0##: overwrite, whatever is in the database should be overwritten. This is what Maven XAR plugin set by default when generating the XAR.
44 *** ##1##: skip, skip this document
45 *** ##2##: merge, try to merge the document with what's in the database
46 ** The value inside the ##file## element is the reference of the page, relative to the current wiki (i.e. ##Space.Page##)
47
48 All the date are stored as the number of milliseconds since January 1, 1970, 00:00:00 in GMT time zone.
49
50 == Changelog ==
51
52 === 1.1 ===
53
54 //XWiki 10.3//
55
56 * Added optional ##type## attribute in ##<file>## elements
57
58 = Document XML file =
59
60 Usually the documents files are located in a path where each parent space is a folder (as in ##Space/NestedSpace/Page.xml##) but this is not technically mandatory and parsers won't take the path into account (only what is indicated in the actual document file).
61
62 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>>platform:DevGuide.Standard URL Format||anchor="HParameter:xpage"]].
63
64 {{code}}
65 <xwikidoc version="1.4" reference="Space.NestedSpace.Page" locale="">
66 <web>Space.NestedSpace</web>
67 <name>Page</name>
68 <language/>
69 <defaultLanguage>en</defaultLanguage>
70 <translation>0</translation>
71 <creator>XWiki.creator</creator>
72 <creationDate>946684800000</creationDate>
73 <versions>jrcsrevisions</versions>
74 <parent>parent</parent>
75 <author>XWiki.author</author>
76 <customClass>customclass</customClass>
77 <contentAuthor>XWiki.contentAuthor</contentAuthor>
78 <date>946771200000</date>
79 <contentUpdateDate>946857600000</contentUpdateDate>
80 <version>1.1</version>
81 <title>title</title>
82 <defaultTemplate>defaultTemplate</defaultTemplate>
83 <validationScript>validationScript</validationScript>
84 <comment>comment</comment>
85 <minorEdit>false</minorEdit>
86 <syntaxId>syntax/1.0</syntaxId>
87 <hidden>true</hidden>
88 <content>content</content>
89 <renderedcontent/>
90 <attachment>
91 <filename>attachment.txt</filename>
92 <versions>jrcsrevisions</versions>
93 <author>XWiki.author</author>
94 <date>947030400000</date>
95 <version>1.3</version>
96 <comment>comment</comment>
97 <content>AAECAwQFBgcICQ==</content>
98 <filesize>10</filesize>
99 <revisions>
100 <revision>
101 <author>XWiki.author11</author>
102 <date>747030400000</date>
103 <version>1.1</version>
104 <comment>Comment 1.1</comment>
105 <content>MS4x</content>
106 </revision>
107 <revision>
108 <author>XWiki.author12</author>
109 <date>847030400000</date>
110 <version>1.2</version>
111 <comment>Comment 1.2</comment>
112 <contentAlias>1.1</contentAlias>
113 </revision>
114 <revision>
115 <author>XWiki.author13</author>
116 <date>947030400000</date>
117 <version>1.3</version>
118 <comment>Comment 1.3</comment>
119 <contentAlias/>
120 </revision>
121 </revisions>
122 </attachment>
123 <class>
124 <name>Space.NestedSpace.Page</name>
125 <customClass>customClass</customClass>
126 <customMapping>customMapping</customMapping>
127 <defaultViewSheet>defaultViewSheet</defaultViewSheet>
128 <defaultEditSheet>defaultEditSheet</defaultEditSheet>
129 <defaultWeb>defaultWeb</defaultWeb>
130 <nameField>nameField</nameField>
131 <validationScript>validationScript</validationScript>
132 <prop1>
133 <disabled>0</disabled>
134 <name>prop1</name>
135 <number>1</number>
136 <numberType>long</numberType>
137 <prettyName>Prop1</prettyName>
138 <size>30</size>
139 <unmodifiable>0</unmodifiable>
140 <classType>com.xpn.xwiki.objects.classes.NumberClass</classType>
141 </prop1>
142 </class>
143 <object>
144 <name>Space.NestedSpace.Page</name>
145 <number>0</number>
146 <className>Space.NestedSpace.Page</className>
147 <guid>e2167721-2a64-430c-9520-bac1c0ee68cb</guid>
148 <class>
149 <name>Space.NestedSpace.Page</name>
150 <customClass>customClass</customClass>
151 <customMapping>customMapping</customMapping>
152 <defaultViewSheet>defaultViewSheet</defaultViewSheet>
153 <defaultEditSheet>defaultEditSheet</defaultEditSheet>
154 <defaultWeb>defaultWeb</defaultWeb>
155 <nameField>nameField</nameField>
156 <validationScript>validationScript</validationScript>
157 <prop1>
158 <disabled>0</disabled>
159 <name>prop1</name>
160 <number>1</number>
161 <numberType>long</numberType>
162 <prettyName>Prop1</prettyName>
163 <size>30</size>
164 <unmodifiable>0</unmodifiable>
165 <classType>com.xpn.xwiki.objects.classes.NumberClass</classType>
166 </prop1>
167 </class>
168 <property>
169 <prop1>1</prop1>
170 </property>
171 </object>
172 <object>
173 <name>Space.NestedSpace.Page</name>
174 <number>0</number>
175 <className>otherclass</className>
176 <guid>8eaeac52-e2f2-47b2-87e1-bc6909597b39</guid>
177 <class>
178 <name>otherclass</name>
179 <customClass>customClass2</customClass>
180 <customMapping>customMapping2</customMapping>
181 <defaultViewSheet>defaultViewSheet2</defaultViewSheet>
182 <defaultEditSheet>defaultEditSheet2</defaultEditSheet>
183 <defaultWeb>defaultWeb2</defaultWeb>
184 <nameField>nameField2</nameField>
185 <validationScript>validationScript2</validationScript>
186 <prop2>
187 <disabled>0</disabled>
188 <name>prop2</name>
189 <number>1</number>
190 <numberType>long</numberType>
191 <prettyName>Prop2</prettyName>
192 <size>30</size>
193 <unmodifiable>0</unmodifiable>
194 <classType>com.xpn.xwiki.objects.classes.NumberClass</classType>
195 </prop2>
196 </class>
197 <property>
198 <prop2>2</prop2>
199 </property>
200 </object>
201 </xwikidoc>
202 {{/code}}
203
204 * ##xwikidoc##: the root XML element
205 ** //version// {{info}}since [[1.1>>||anchor="H1.1-1"]]{{/info}}: the version of the XML format, if no specified then it's ##1.0##
206 ** //reference// {{info}}since [[1.2>>||anchor="H1.2"]]{{/info}}: the reference of the document
207 ** //locale// {{info}}since [[1.2>>||anchor="H1.2"]]{{/info}}: the locale (as defined in [[Java Locale specifications>>http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html]]) of the document
208 ** ##web##: {{warning}}deprecated since [[1.2>>||anchor="H1.2"]]{{/warning}} property containing the unique space of the document, not taken into account when //reference// attribute is set in ##xwikidoc##
209 ** ##name##: {{warning}}deprecated since [[1.2>>||anchor="H1.2"]]{{/warning}} the name of the document, not taken into account when //reference// attribute is set in ##xwikidoc##
210 ** ##language##: {{warning}}deprecated since [[1.2>>||anchor="H1.2"]]{{/warning}} the locale (as defined in [[Java Locale specifications>>http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html]]) of the document, not taken into account when //reference// attribute is set in ##xwikidoc##
211
212 * ##attachment##
213 ** //filename//: the name of the file
214 ** //author//: the author of the attachment
215 ** //date//: epoch date and time
216 ** //version//: the version of the attachment
217 ** //comment//: the comment associated to the version of the attachment
218 ** //content//: the binary content serialized in base64
219 ** //filesize//: the size of the attachment in bytes
220 ** //mimetype//: the MIME type of the attachment (as expressed by the [[RFC 6838>>https://tools.ietf.org/html/rfc6838]])
221 ** //charset//: the charset of the attachment (as expressed in the HTTP Content-Type)
222 ** //versions// {{warning}}deprecated since [[1.4>>||anchor="H1.4"]]{{/warning}}: JRCS Archive dump containing the history of the attachment, deprecated since 12.0
223 ** //revisions// {{info}}since [[1.4>>||anchor="H1.4"]]{{/info}}: the revisions of the attachment (replace //versions//), contains the same properties than the attachment plus "contentAlias"
224 *** //revision/contentAlias//: an alias to the content of the indicated version of the attachment revision. Empty string for current attachment.
225
226 {{todo}}
227 Put some documentation for other elements
228 {{/todo}}
229
230 == Changelog ==
231
232 === 1.4 ===
233
234 //XWiki 12.0//
235
236 New format for attachments revisions which allows streaming and deduplication.
237
238 === 1.3 ===
239
240 //XWiki 9.0//
241
242 Use XML 1.1 (instead of 1.0).
243
244 === 1.2 ===
245
246 //XWiki 7.2//
247
248 Support for nested spaces.
249
250 * ##<web>##, ##<name>## and ##<language>## are deprecated (but still produced)
251 * new ##reference## and ##locale## attributes in ##<document>## element
252
253 === 1.1 ===
254
255 //XWiki 6.2//
256
257 No meaningful change. It's just to mark the difference between the first version of the XML produced by Filter module (1.1) and the XML produced by XWikiDocument#toXML().
258
259 New ##version## attribute in ##<document>## element to indicate the XAR format version (i.e. ##1.1## here).
260
261 The formatting changed are:
262
263 * order of elements changed a bit
264 * the XML is indented

Get Connected