Class DOMDocument

java.lang.Object
writer2latex.xmerge.DOMDocument
All Implemented Interfaces:
OutputFile, Document
Direct Known Subclasses:
NewDOMDocument, XhtmlDocument

public class DOMDocument extends Object implements Document
An implementation of Document for StarOffice documents.
  • Constructor Details

    • DOMDocument

      public DOMDocument(String name, String ext)
      Default constructor.
      Parameters:
      name - Document name.
      ext - Document extension.
    • DOMDocument

      public DOMDocument(String name, String ext, boolean namespaceAware, boolean validating)
      Constructor with arguments to set namespaceAware and validating flags.
      Parameters:
      name - Document name (may or may not contain extension).
      ext - Document extension.
      namespaceAware - Value for namespaceAware flag.
      validating - Value for validating flag.
  • Method Details

    • getFileExtension

      protected String getFileExtension()
      Returns the file extension of the Document represented.
      Returns:
      file extension of the Document.
    • getContentDOM

      public Document getContentDOM()
      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.
    • setContentDOM

      public void setContentDOM(Node newDom)
      Sets the Content of the Document to the contents of the supplied Node list.
      Parameters:
      newDom - DOM Document object.
    • getName

      public String getName()
      Return the name of the Document.
      Specified by:
      getName in interface Document
      Returns:
      The name of Document.
    • getFileName

      public String getFileName()
      Return the file name of the Document, possibly with the standard extension.
      Specified by:
      getFileName in interface OutputFile
      Returns:
      The file name of Document.
    • read

      public void read(InputStream is) throws IOException
      Read the Office Document from the specified InputStream.
      Specified by:
      read in interface Document
      Parameters:
      is - Office document InputStream.
      Throws:
      IOException - If any I/O error occurs.
    • write

      public void write(OutputStream os) throws IOException
      Write out content to the supplied OutputStream.
      Specified by:
      write in interface OutputFile
      Parameters:
      os - XML OutputStream.
      Throws:
      IOException - If any I/O error occurs.
    • initContentDOM

      public final void initContentDOM() throws IOException
      Initializes a new DOM Document with the content containing minimum XML tags.
      Throws:
      IOException - If any I/O error occurs.