Package writer2latex.base
Class DOMDocument
- java.lang.Object
-
- writer2latex.base.DOMDocument
-
- All Implemented Interfaces:
OutputFile
- Direct Known Subclasses:
ContainerWriter,NCXWriter,OPFWriter,XhtmlDocument
public class DOMDocument extends java.lang.Object implements OutputFile
This class represents XML-based documents. It is loosely based on a class from the former xmerge project from OOo.
-
-
Constructor Summary
Constructors Constructor Description DOMDocument(java.lang.String name, java.lang.String ext)Default constructor.DOMDocument(java.lang.String name, java.lang.String ext, boolean namespaceAware, boolean validating)Constructor with arguments to setnamespaceAwareandvalidatingflags.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.w3c.dom.DocumentgetContentDOM()Return a DOMDocumentobject of the document content file.protected java.lang.StringgetFileExtension()Returns the file extension of theDocumentrepresented.java.lang.StringgetFileName()Return the file name of theDocument, possibly with the standard extension.java.lang.StringgetMIMEType()Get the MIME type of theOutputFile.java.lang.StringgetName()Return the name of theDocument.voidinitContentDOM()Initializes a new DOMDocumentwith the content containing minimum XML tags.booleanisMasterDocument()Test whether this document is part of the main document flow (master documents) or an auxiliary documentvoidread(java.io.InputStream is)Read the OfficeDocumentfrom the specifiedInputStream.voidsetContentDOM(org.w3c.dom.Node newDom)Sets the Content of theDocumentto the contents of the suppliedNodelist.voidwrite(java.io.OutputStream os)Write out content to the suppliedOutputStream.
-
-
-
Constructor Detail
-
DOMDocument
public DOMDocument(java.lang.String name, java.lang.String ext)Default constructor.- Parameters:
name-Documentname.ext-Documentextension.
-
DOMDocument
public DOMDocument(java.lang.String name, java.lang.String ext, boolean namespaceAware, boolean validating)Constructor with arguments to setnamespaceAwareandvalidatingflags.- Parameters:
name-Documentname (may or may not contain extension).ext-Documentextension.namespaceAware- Value fornamespaceAwareflag.validating- Value forvalidatingflag.
-
-
Method Detail
-
getFileExtension
protected java.lang.String getFileExtension()
Returns the file extension of theDocumentrepresented.- Returns:
- file extension of the
Document.
-
getContentDOM
public org.w3c.dom.Document getContentDOM()
Return a DOMDocumentobject of the document content file. Note that a content DOM is not created when the constructor is called. So, either thereadmethod or theinitContentDOMmethod will need to be called ahead on this object before calling this method.- Returns:
- DOM
Documentobject.
-
setContentDOM
public void setContentDOM(org.w3c.dom.Node newDom)
Sets the Content of theDocumentto the contents of the suppliedNodelist.- Parameters:
newDom- DOMDocumentobject.
-
getName
public java.lang.String getName()
Return the name of theDocument.- Returns:
- The name of
Document.
-
getFileName
public java.lang.String getFileName()
Return the file name of theDocument, possibly with the standard extension.- Specified by:
getFileNamein interfaceOutputFile- Returns:
- The file name of
Document.
-
read
public void read(java.io.InputStream is) throws java.io.IOExceptionRead the OfficeDocumentfrom the specifiedInputStream.- Parameters:
is- Office documentInputStream.- Throws:
java.io.IOException- If any I/O error occurs.
-
write
public void write(java.io.OutputStream os) throws java.io.IOExceptionWrite out content to the suppliedOutputStream. (with pretty printing)- Specified by:
writein interfaceOutputFile- Parameters:
os- XMLOutputStream.- Throws:
java.io.IOException- If any I/O error occurs.
-
initContentDOM
public final void initContentDOM() throws java.io.IOExceptionInitializes a new DOMDocumentwith the content containing minimum XML tags.- Throws:
java.io.IOException- If any I/O error occurs.
-
getMIMEType
public java.lang.String getMIMEType()
Description copied from interface:OutputFileGet the MIME type of theOutputFile.- Specified by:
getMIMETypein interfaceOutputFile- Returns:
- string representation of the MIME type
-
isMasterDocument
public boolean isMasterDocument()
Description copied from interface:OutputFileTest whether this document is part of the main document flow (master documents) or an auxiliary document- Specified by:
isMasterDocumentin interfaceOutputFile- Returns:
- true if this document is a master document
-
-