Class DOMDocument

    • 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 set namespaceAware and validating flags.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.w3c.dom.Document getContentDOM()
      Return a DOM Document object of the document content file.
      protected java.lang.String getFileExtension()
      Returns the file extension of the Document represented.
      java.lang.String getFileName()
      Return the file name of the Document, possibly with the standard extension.
      java.lang.String getName()
      Return the name of the Document.
      void initContentDOM()
      Initializes a new DOM Document with the content containing minimum XML tags.
      void read​(java.io.InputStream is)
      Read the Office Document from the specified InputStream.
      void setContentDOM​(org.w3c.dom.Node newDom)
      Sets the Content of the Document to the contents of the supplied Node list.
      void write​(java.io.OutputStream os)
      Write out content to the supplied OutputStream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DOMDocument

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

        public DOMDocument​(java.lang.String name,
                           java.lang.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 Detail

      • getFileExtension

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

        public org.w3c.dom.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​(org.w3c.dom.Node newDom)
        Sets the Content of the Document to the contents of the supplied Node list.
        Parameters:
        newDom - DOM Document object.
      • getName

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

        public java.lang.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​(java.io.InputStream is)
                  throws java.io.IOException
        Read the Office Document from the specified InputStream.
        Specified by:
        read in interface Document
        Parameters:
        is - Office document InputStream.
        Throws:
        java.io.IOException - If any I/O error occurs.
      • write

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

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