Wiki source code of Parse and analyze a package

Last modified by Raphaël Jakse on 2026/03/23 11:35

Hide last authors
Raphaël Jakse 1.1 1 Confluence XML exposes its component in charge of parsing and analyzing confluence exports. It can be used independently by using component ##org.xwiki.contrib.confluence.filter.input.ConfluenceXMLPackage##:
2
3 {{code language="java"}}
Raphaël Jakse 2.1 4 @Inject
5 private Provider<ConfluenceXMLPackage> confluencePackageProvider;
Raphaël Jakse 1.1 6
Raphaël Jakse 2.1 7 public void analyze()
8 {
9 // Create a new instance of ConfluenceXMLPackage component
10 ConfluenceXMLPackage confluencePackage = this.confluencePackageProvider.get();
Raphaël Jakse 1.1 11
Raphaël Jakse 2.1 12 // Parse the packaged located on the file system (but support any org.xwiki.filter.input.InputSource which lead to a zip content or a directory)
13 confluencePackage.read(new DefaultFileInputSource(new File("path/to/the/confluencepackage.xml.zip")));
Raphaël Jakse 1.1 14
Raphaël Jakse 2.1 15 // Call the various getters of ConfluenceXMLPackage
16 }
Raphaël Jakse 1.1 17 {{/code}}

Get Connected