Class XDOMOfficeDocument
- java.lang.Object
-
- org.xwiki.officeimporter.document.XDOMOfficeDocument
-
- All Implemented Interfaces:
Closeable,AutoCloseable,OfficeDocument
public class XDOMOfficeDocument extends Object implements OfficeDocument
AnOfficeDocumentbacked by anXDOMdocument.- Since:
- 2.1M1
- Version:
- $Id: 540d6fd1bab9da09c3517dc47b862c5dd6acebe2 $
-
-
Constructor Summary
Constructors Constructor Description XDOMOfficeDocument(XDOM xdom, Map<String,OfficeDocumentArtifact> artifacts, org.xwiki.component.manager.ComponentManager componentManager, OfficeConverterResult converterResult)Creates a newXDOMOfficeDocument.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Map<String,OfficeDocumentArtifact>getArtifactsMap()Returns the files corresponding to all the artifacts for this office document, except the conversion of the document itself.StringgetContentAsString()Returns the content of this document as a string.StringgetContentAsString(String syntaxId)Renders the XDOM encapsulated by this document into the given syntax.XDOMgetContentDocument()Returns the content of this office document.OfficeConverterResultgetConverterResult()StringgetTitle()Tries to extract a title suitable for this document.
-
-
-
Constructor Detail
-
XDOMOfficeDocument
@Unstable public XDOMOfficeDocument(XDOM xdom, Map<String,OfficeDocumentArtifact> artifacts, org.xwiki.component.manager.ComponentManager componentManager, OfficeConverterResult converterResult)
Creates a newXDOMOfficeDocument.- Parameters:
xdom-XDOMcorresponding to office document content.artifacts- artifacts for this office document.componentManager-ComponentManagerused to lookup for various renderers.converterResult- theOfficeConverterResultused to build that object.- Since:
- 14.10.8, 15.3RC1
-
-
Method Detail
-
getContentDocument
public XDOM getContentDocument()
Description copied from interface:OfficeDocumentReturns the content of this office document. Content document type may vary depending on the implementation. For an example, a particular implementation might return an html DOM object while another implementation might return an XDOM.- Specified by:
getContentDocumentin interfaceOfficeDocument- Returns:
- content of this document.
-
getContentAsString
public String getContentAsString()
Description copied from interface:OfficeDocumentReturns the content of this document as a string.- Specified by:
getContentAsStringin interfaceOfficeDocument- Returns:
- content of this document as a string.
-
getContentAsString
public String getContentAsString(String syntaxId)
Renders the XDOM encapsulated by this document into the given syntax.- Parameters:
syntaxId- string identifier of the syntax.- Returns:
- content of this document in the given syntax or null if the syntax is invalid.
-
getArtifactsMap
public Map<String,OfficeDocumentArtifact> getArtifactsMap()
Description copied from interface:OfficeDocumentReturns the files corresponding to all the artifacts for this office document, except the conversion of the document itself. Artifacts are generated during the import operation if the original office document contains embedded non-textual elements. Also, some office formats (like presentations) result in multiple output files when converted into html. In this case all these output files will be considered as artifacts.The key of the map is the artifact name.
- Specified by:
getArtifactsMapin interfaceOfficeDocument- Returns:
- the map of artifact names to artifacts related to this office document
-
getTitle
public String getTitle()
Tries to extract a title suitable for this document. This is done by navigating the internalXDOMand finding a matching header block.- Returns:
- a title suitable for this document or null if no title can be found.
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceOfficeDocument- Throws:
IOException
-
getConverterResult
public OfficeConverterResult getConverterResult()
- Specified by:
getConverterResultin interfaceOfficeDocument- Returns:
- the converter result.
-
-