Wiki source code of XAR Format Specifications

Last modified by Thomas Mortagne on 2023/04/11 13:05

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 = Format for package.xml =
6
7 == Current Format ==
8
9 {{code language="xml"}}
10 <package>
11 <infos>
12 <name>Package Name</name>
13 <description>A description of the package</description>
14 <licence>Some License 2.0</licence>
15 <author>XWiki.User</author>
16 <extensionId>extension-id</extensionId>
17 <version>1.0</version>
18 <backupPack>false</backupPack>
19 </infos>
20 <files>
21 <file language="" defaultAction="0" type="home">Main.WebHome</file>
22 <file language="" defaultAction="0">Space.NestedSpace.Page</file>
23 <file language="" defaultAction="0">Space.TranslatedPage</file>
24 <file language="fr" defaultAction="0">Space.TranslatedPage</file>
25 </files>
26 </package>
27 {{/code}}
28
29 * ##name##: name representing what's contained in the XAR
30 * ##description##: more detailed description of the content of the XAR
31 * ##license##: can be set to specify under which license this XAR content is published
32 * ##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).
33 * ##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.
34 * ##preserveVersion## (optional): if set to true then the history is preserved (the history for each page is part of its XML)
35 * ##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.
36 * ##files##
37 ** ##language##: the language of the page. The default page content should use an empty string.
38 ** ##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. More details about those can be found on [[XAR Extensions documentation>>extensions:Extension.Extension Module.Extensions.XAR||anchor="HStandardtypes"]]
39 ** ##defaultAction## {{warning}}deprecated{{/warning}}: when applied (which is not very often) this is the default action to apply on the document
40 *** ##-1##: undefined, its exact interpretation depends on what is reading it
41 *** ##0##: overwrite, whatever is in the database should be overwritten. This is what Maven XAR plugin set by default when generating the XAR.
42 *** ##1##: skip, skip this document
43 *** ##2##: merge, try to merge the document with what's in the database
44 ** The value inside the ##file## element is the reference of the page, relative to the current wiki (i.e. ##Space.Page##)
45
46 All the date are stored as the number of milliseconds since January 1, 1970, 00:00:00 in GMT time zone.
47
48 == Changelog ==
49
50 === 1.1 ===
51
52 //XWiki 10.3//
53
54 * Added optional ##type## attribute in ##<file>## elements
55
56 = Format for Document XML =
57
58 == Current Format ==
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>>xwiki:Documentation.DevGuide.Architecture.URL Architecture.Standard URL Format||anchor="HParameter:xpage"]].
63
64 {{code}}
65 <xwikidoc version="1.5" 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 <originalMetadataAuthor>XWiki.originalAuthor</originalMetadataAuthor>
77 <customClass>customclass</customClass>
78 <contentAuthor>XWiki.contentAuthor</contentAuthor>
79 <date>946771200000</date>
80 <contentUpdateDate>946857600000</contentUpdateDate>
81 <version>1.1</version>
82 <title>title</title>
83 <defaultTemplate>defaultTemplate</defaultTemplate>
84 <validationScript>validationScript</validationScript>
85 <comment>comment</comment>
86 <minorEdit>false</minorEdit>
87 <syntaxId>syntax/1.0</syntaxId>
88 <hidden>true</hidden>
89 <content>content</content>
90 <renderedcontent/>
91 <attachment>
92 <filename>attachment.txt</filename>
93 <versions>jrcsrevisions</versions>
94 <author>XWiki.author</author>
95 <date>947030400000</date>
96 <version>1.3</version>
97 <comment>comment</comment>
98 <content>AAECAwQFBgcICQ==</content>
99 <filesize>10</filesize>
100 <revisions>
101 <revision>
102 <author>XWiki.author11</author>
103 <date>747030400000</date>
104 <version>1.1</version>
105 <comment>Comment 1.1</comment>
106 <content>MS4x</content>
107 </revision>
108 <revision>
109 <author>XWiki.author12</author>
110 <date>847030400000</date>
111 <version>1.2</version>
112 <comment>Comment 1.2</comment>
113 <contentAlias>1.1</contentAlias>
114 </revision>
115 <revision>
116 <author>XWiki.author13</author>
117 <date>947030400000</date>
118 <version>1.3</version>
119 <comment>Comment 1.3</comment>
120 <contentAlias/>
121 </revision>
122 </revisions>
123 </attachment>
124 <class>
125 <name>Space.NestedSpace.Page</name>
126 <customClass>customClass</customClass>
127 <customMapping>customMapping</customMapping>
128 <defaultViewSheet>defaultViewSheet</defaultViewSheet>
129 <defaultEditSheet>defaultEditSheet</defaultEditSheet>
130 <defaultWeb>defaultWeb</defaultWeb>
131 <nameField>nameField</nameField>
132 <validationScript>validationScript</validationScript>
133 <prop1>
134 <disabled>0</disabled>
135 <name>prop1</name>
136 <number>1</number>
137 <numberType>long</numberType>
138 <prettyName>Prop1</prettyName>
139 <size>30</size>
140 <unmodifiable>0</unmodifiable>
141 <classType>com.xpn.xwiki.objects.classes.NumberClass</classType>
142 </prop1>
143 </class>
144 <object>
145 <name>Space.NestedSpace.Page</name>
146 <number>0</number>
147 <className>Space.NestedSpace.Page</className>
148 <guid>e2167721-2a64-430c-9520-bac1c0ee68cb</guid>
149 <class>
150 <name>Space.NestedSpace.Page</name>
151 <customClass>customClass</customClass>
152 <customMapping>customMapping</customMapping>
153 <defaultViewSheet>defaultViewSheet</defaultViewSheet>
154 <defaultEditSheet>defaultEditSheet</defaultEditSheet>
155 <defaultWeb>defaultWeb</defaultWeb>
156 <nameField>nameField</nameField>
157 <validationScript>validationScript</validationScript>
158 <prop1>
159 <disabled>0</disabled>
160 <name>prop1</name>
161 <number>1</number>
162 <numberType>long</numberType>
163 <prettyName>Prop1</prettyName>
164 <size>30</size>
165 <unmodifiable>0</unmodifiable>
166 <classType>com.xpn.xwiki.objects.classes.NumberClass</classType>
167 </prop1>
168 </class>
169 <property>
170 <prop1>1</prop1>
171 </property>
172 </object>
173 <object>
174 <name>Space.NestedSpace.Page</name>
175 <number>0</number>
176 <className>otherclass</className>
177 <guid>8eaeac52-e2f2-47b2-87e1-bc6909597b39</guid>
178 <class>
179 <name>otherclass</name>
180 <customClass>customClass2</customClass>
181 <customMapping>customMapping2</customMapping>
182 <defaultViewSheet>defaultViewSheet2</defaultViewSheet>
183 <defaultEditSheet>defaultEditSheet2</defaultEditSheet>
184 <defaultWeb>defaultWeb2</defaultWeb>
185 <nameField>nameField2</nameField>
186 <validationScript>validationScript2</validationScript>
187 <prop2>
188 <disabled>0</disabled>
189 <name>prop2</name>
190 <number>1</number>
191 <numberType>long</numberType>
192 <prettyName>Prop2</prettyName>
193 <size>30</size>
194 <unmodifiable>0</unmodifiable>
195 <classType>com.xpn.xwiki.objects.classes.NumberClass</classType>
196 </prop2>
197 </class>
198 <property>
199 <prop2>2</prop2>
200 </property>
201 </object>
202 </xwikidoc>
203 {{/code}}
204
205 * ##xwikidoc##: the root XML element
206 ** //version// {{info}}since [[1.1>>||anchor="H1.1-1"]]{{/info}}: the version of the XML format, if no specified then it's ##1.0##
207 ** //reference// {{info}}since [[1.2>>||anchor="H1.2"]]{{/info}}: the reference of the document
208 ** //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
209 ** ##web##: {{warning}}deprecated since [[1.2>>||anchor="H1.2"]] in favor of the the //reference// attribute{{/warning}} property containing the unique space of the document, not taken into account when //reference// attribute is set in ##xwikidoc##
210 ** ##name##: {{warning}}deprecated since [[1.2>>||anchor="H1.2"]] in favor of the the //reference// attribute{{/warning}} the name of the document, not taken into account when //reference// attribute is set in ##xwikidoc##
211 ** ##language##: {{warning}}deprecated since [[1.2>>||anchor="H1.2"]] in favor of the the //locale// attribute{{/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##
212 ** ##date##: the last modification date of the document (format: epoch date and time UTC)
213 ** ##contentUpdateDate##: the last modification date of the document content (format: epoch date and time UTC)
214 ** ##versions##: a serialized version of the ##com.xpn.xwiki.doc.rcs.XWikiRCSArchive## Java object
215
216 * ##attachment##
217 ** //filename//: the name of the file
218 ** //author//: the author of the attachment
219 ** //date//: epoch date and time UTC
220 ** //version//: the version of the attachment
221 ** //comment//: the comment associated to the version of the attachment
222 ** //content//: the binary content serialized in base64
223 ** //filesize//: the size of the attachment in bytes
224 ** //mimetype//: the MIME type of the attachment (as expressed by the [[RFC 6838>>https://tools.ietf.org/html/rfc6838]])
225 ** //charset//: the charset of the attachment (as expressed in the HTTP Content-Type)
226 ** //versions// {{warning}}deprecated since [[1.4>>||anchor="H1.4"]] in vafor of //revisions//{{/warning}}: JRCS Archive dump containing the history of the attachment, deprecated since 12.0
227 ** //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"
228 *** //revision/contentAlias//: an alias to the content of the indicated version of the attachment revision. Empty string for current attachment.
229
230 {{todo}}
231 Put some documentation for other elements
232 {{/todo}}
233
234 == Changelog ==
235
236 === 1.5 ===
237
238 //XWiki 14.0//
239
240 Add the concept of original metadata document author.
241
242 === 1.4 ===
243
244 //XWiki 12.0//
245
246 New format for attachments revisions which allows streaming and deduplication.
247
248 === 1.3 ===
249
250 //XWiki 9.0//
251
252 Use XML 1.1 (instead of 1.0).
253
254 === 1.2 ===
255
256 //XWiki 7.2//
257
258 Support for nested spaces.
259
260 * ##<web>##, ##<name>## and ##<language>## are deprecated (but still produced)
261 * new ##reference## and ##locale## attributes in ##<document>## element
262
263 === 1.1 ===
264
265 //XWiki 6.2//
266
267 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().
268
269 New ##version## attribute in ##<document>## element to indicate the XAR format version (i.e. ##1.1## here).
270
271 The formatting changed are:
272
273 * order of elements changed a bit
274 * the XML is indented

Get Connected