Wiki source code of Parse and analyze a package
Last modified by Raphaël Jakse on 2026/03/23 11:35
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 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"}} | ||
| 4 | @Inject | ||
| 5 | private Provider<ConfluenceXMLPackage> confluencePackageProvider; | ||
| 6 | |||
| 7 | public void analyze() | ||
| 8 | { | ||
| 9 | // Create a new instance of ConfluenceXMLPackage component | ||
| 10 | ConfluenceXMLPackage confluencePackage = this.confluencePackageProvider.get(); | ||
| 11 | |||
| 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"))); | ||
| 14 | |||
| 15 | // Call the various getters of ConfluenceXMLPackage | ||
| 16 | } | ||
| 17 | {{/code}} |