Package writer2latex.base
Class DOMDocument
java.lang.Object
writer2latex.base.DOMDocument
- All Implemented Interfaces:
OutputFile
- Direct Known Subclasses:
ContainerWriter,NavigationWriter,NCXWriter,OPFWriter,XhtmlDocument
This class represents XML-based documents. It is loosely based on a class from the former xmerge project
from OOo.
-
Constructor Summary
ConstructorsConstructorDescriptionDOMDocument(String name, String ext) Default constructor.DOMDocument(String name, String ext, boolean namespaceAware, boolean validating) Constructor with arguments to setnamespaceAwareandvalidatingflags. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTest whether this document contains mathematical formulasReturn a DOMDocumentobject of the document content file.protected StringReturns the file extension of theDocumentrepresented.Return the file name of theDocument, possibly with the standard extension.Get the MIME type of theOutputFile.getName()Return the name of theDocument.final voidInitializes a new DOMDocumentwith the content containing minimum XML tags.booleanTest whether this document is part of the main document flow (master documents) or an auxiliary documentvoidread(InputStream is) Read the OfficeDocumentfrom the specifiedInputStream.voidsetContentDOM(Node newDom) Sets the Content of theDocumentto the contents of the suppliedNodelist.voidwrite(OutputStream os) Write out content to the suppliedOutputStream.
-
Constructor Details
-
DOMDocument
Default constructor.- Parameters:
name-Documentname.ext-Documentextension.
-
DOMDocument
Constructor with arguments to setnamespaceAwareandvalidatingflags.- Parameters:
name-Documentname (may or may not contain extension).ext-Documentextension.namespaceAware- Value fornamespaceAwareflag.validating- Value forvalidatingflag.
-
-
Method Details
-
getFileExtension
Returns the file extension of theDocumentrepresented.- Returns:
- file extension of the
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
Sets the Content of theDocumentto the contents of the suppliedNodelist.- Parameters:
newDom- DOMDocumentobject.
-
getName
Return the name of theDocument.- Returns:
- The name of
Document.
-
getFileName
Return the file name of theDocument, possibly with the standard extension.- Specified by:
getFileNamein interfaceOutputFile- Returns:
- The file name of
Document.
-
read
Read the OfficeDocumentfrom the specifiedInputStream.- Parameters:
is- Office documentInputStream.- Throws:
IOException- If any I/O error occurs.
-
write
Write out content to the suppliedOutputStream. (with pretty printing)- Specified by:
writein interfaceOutputFile- Parameters:
os- XMLOutputStream.- Throws:
IOException- If any I/O error occurs.
-
initContentDOM
Initializes a new DOMDocumentwith the content containing minimum XML tags.- Throws:
IOException- If any I/O error occurs.
-
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
-
containsMath
public boolean containsMath()Description copied from interface:OutputFileTest whether this document contains mathematical formulas- Specified by:
containsMathin interfaceOutputFile- Returns:
- true if the document contains formulas
-