LibreOffice Module xmerge (master) 1
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
org.openoffice.xmerge.converter.dom.DOMDocument Class Reference

An implementation of Document for StarOffice documents. More...

Inheritance diagram for org.openoffice.xmerge.converter.dom.DOMDocument:
[legend]
Collaboration diagram for org.openoffice.xmerge.converter.dom.DOMDocument:
[legend]

Public Member Functions

 DOMDocument (String name, String ext)
 Default constructor. More...
 
Document getContentDOM ()
 Return a DOM Document object of the document content file. More...
 
void setContentDOM (Node newDom)
 Sets the Content of the Document to the contents of the supplied Node list. More...
 
String getName ()
 Return the name of the Document. More...
 
String getFileName ()
 Return the file name of the Document, possibly with the standard extension. More...
 
void read (InputStream is) throws IOException
 Read the Office Document from the specified InputStream. More...
 
void write (OutputStream os) throws IOException
 Write out content to the supplied OutputStream. More...
 
void write (OutputStream os) throws IOException
 Writes out the Document content to the specified OutputStream. More...
 
void read (InputStream is) throws IOException
 Reads the content from the InputStream into the Document. More...
 
String getName ()
 Returns the Document name with no file extension. More...
 
String getFileName ()
 Returns the Document name with file extension. More...
 

Private Member Functions

String getFileExtension ()
 Returns the file extension of the Document represented. More...
 
 DOMDocument (String name, String ext, boolean namespaceAware, boolean validating)
 Constructor with arguments to set namespaceAware and validating flags. More...
 
String trimDocumentName (String name)
 Removes the file extension from the Document name. More...
 
byte[] docToBytes (Document doc) throws IOException
 Write out a org.w3c.dom.Document object into a byte array. More...
 

Private Attributes

Document contentDoc = null
 DOM Document of content.xml. More...
 
String documentName = null
 
String fileName = null
 
String fileExt = null
 

Static Private Attributes

static DocumentBuilderFactory factory
 Factory for DocumentBuilder objects. More...
 

Detailed Description

An implementation of Document for StarOffice documents.

Definition at line 43 of file DOMDocument.java.

Constructor & Destructor Documentation

◆ DOMDocument() [1/2]

org.openoffice.xmerge.converter.dom.DOMDocument.DOMDocument ( String  name,
String  ext 
)
inline

Default constructor.

Parameters
nameDocument name.
extDocument extension.

Definition at line 63 of file DOMDocument.java.

References name.

◆ DOMDocument() [2/2]

org.openoffice.xmerge.converter.dom.DOMDocument.DOMDocument ( String  name,
String  ext,
boolean  namespaceAware,
boolean  validating 
)
inlineprivate

Constructor with arguments to set namespaceAware and validating flags.

Parameters
nameDocument name (may or may not contain extension).
extDocument extension.
namespaceAwareValue for namespaceAware flag.
validatingValue for validating flag.

Definition at line 86 of file DOMDocument.java.

References org.openoffice.xmerge.converter.dom.DOMDocument.documentName, org.openoffice.xmerge.converter.dom.DOMDocument.factory, org.openoffice.xmerge.converter.dom.DOMDocument.getFileExtension(), name, and org.openoffice.xmerge.converter.dom.DOMDocument.trimDocumentName().

Member Function Documentation

◆ docToBytes()

byte[] org.openoffice.xmerge.converter.dom.DOMDocument.docToBytes ( Document  doc) throws IOException
inlineprivate

Write out a org.w3c.dom.Document object into a byte array.

TODO: remove dependency on com.sun.xml.tree.XmlDocument package!

Parameters
docDOM Document object.
Returns
byte array of DOM Document object.
Exceptions
IOExceptionIf any I/O error occurs.

Definition at line 209 of file DOMDocument.java.

References Class, con, Exception, Object, result, String, and System.

Referenced by org.openoffice.xmerge.converter.dom.DOMDocument.write().

◆ getContentDOM()

Document org.openoffice.xmerge.converter.dom.DOMDocument.getContentDOM ( )
inline

Return a DOM Document object of the document content file.

Note that a content DOM is not created when the constructor is called. So, either the read method or the initContentDOM method will need to be called ahead on this object before calling this method.

Returns
DOM Document object.

Definition at line 127 of file DOMDocument.java.

References org.openoffice.xmerge.converter.dom.DOMDocument.contentDoc, and Document.

Referenced by org.openoffice.xmerge.converter.xml.xslt.DocumentDeserializerImpl.deserialize().

◆ getFileExtension()

String org.openoffice.xmerge.converter.dom.DOMDocument.getFileExtension ( )
inlineprivate

Returns the file extension of the Document represented.

Returns
file extension of the Document.

Definition at line 72 of file DOMDocument.java.

References org.openoffice.xmerge.converter.dom.DOMDocument.fileExt, and String.

Referenced by org.openoffice.xmerge.converter.dom.DOMDocument.DOMDocument(), and org.openoffice.xmerge.converter.dom.DOMDocument.trimDocumentName().

◆ getFileName()

String org.openoffice.xmerge.converter.dom.DOMDocument.getFileName ( )
inline

Return the file name of the Document, possibly with the standard extension.

Returns
The file name of Document.

Implements org.openoffice.xmerge.Document.

Definition at line 158 of file DOMDocument.java.

References org.openoffice.xmerge.converter.dom.DOMDocument.fileName, and String.

◆ getName()

String org.openoffice.xmerge.converter.dom.DOMDocument.getName ( )
inline

Return the name of the Document.

Returns
The name of Document.

Implements org.openoffice.xmerge.Document.

Definition at line 147 of file DOMDocument.java.

References org.openoffice.xmerge.converter.dom.DOMDocument.documentName, and String.

◆ read()

void org.openoffice.xmerge.converter.dom.DOMDocument.read ( InputStream  is) throws IOException
inline

◆ setContentDOM()

void org.openoffice.xmerge.converter.dom.DOMDocument.setContentDOM ( Node  newDom)
inline

Sets the Content of the Document to the contents of the supplied Node list.

Parameters
newDomDOM Document object.

Definition at line 138 of file DOMDocument.java.

References org.openoffice.xmerge.converter.dom.DOMDocument.contentDoc, and Document.

◆ trimDocumentName()

String org.openoffice.xmerge.converter.dom.DOMDocument.trimDocumentName ( String  name)
inlineprivate

Removes the file extension from the Document name.

Parameters
nameFull Document name with extension.
Returns
Name of Document without the extension.

Definition at line 103 of file DOMDocument.java.

References org.openoffice.xmerge.converter.dom.DOMDocument.getFileExtension(), name, and String.

Referenced by org.openoffice.xmerge.converter.dom.DOMDocument.DOMDocument().

◆ write()

void org.openoffice.xmerge.converter.dom.DOMDocument.write ( OutputStream  os) throws IOException
inline

Write out content to the supplied OutputStream.

Parameters
osXML OutputStream.
Exceptions
IOExceptionIf any I/O error occurs.

Implements org.openoffice.xmerge.Document.

Definition at line 189 of file DOMDocument.java.

References org.openoffice.xmerge.converter.dom.DOMDocument.contentDoc, and org.openoffice.xmerge.converter.dom.DOMDocument.docToBytes().

Member Data Documentation

◆ contentDoc

Document org.openoffice.xmerge.converter.dom.DOMDocument.contentDoc = null
private

◆ documentName

String org.openoffice.xmerge.converter.dom.DOMDocument.documentName = null
private

◆ factory

DocumentBuilderFactory org.openoffice.xmerge.converter.dom.DOMDocument.factory
staticprivate
Initial value:
=
DocumentBuilderFactory.newInstance()

Factory for DocumentBuilder objects.

Definition at line 47 of file DOMDocument.java.

Referenced by org.openoffice.xmerge.converter.dom.DOMDocument.DOMDocument(), and org.openoffice.xmerge.converter.dom.DOMDocument.read().

◆ fileExt

String org.openoffice.xmerge.converter.dom.DOMDocument.fileExt = null
private

◆ fileName

String org.openoffice.xmerge.converter.dom.DOMDocument.fileName = null
private

The documentation for this class was generated from the following file: