Class Document


  • public final class Document
    extends Node
    The root node of a DOM.
    • Method Detail

      • find

        public  path)
        Finds an element based on a path of element names.
        Parameters:
        path - slash separated series of element names
        Returns:
        the matching element, or null if not found
        See Also:
        Element.find(String)
      • newRootElement

        public  name)
        Creates the root element for this document, replacing any previous root element.
      • newRootElement

        public  namespace,
                                       name)
        Creates a new root element within a namespace.
        Parameters:
        namespace - URI of namespace containing the element
        name - name of element with namespace
        Returns:
        the root element
      • toMarkup

        public void toMarkup​(Document document,
                              writer,
                             <,​> namespaceURIToPrefix)
      • getElementById

        public  id)
        Tries to find an element in this document whose id is specified.
        Parameters:
        id - the value of the id attribute of the element being looked for
        Returns:
        the element if found. null if not found.
      • dtd

        public void  name,
                         publicId,
                         systemId)
        Sets the DTD for the document, overriding any prior DTD.
        Parameters:
        name - non-blank name of document type (i.e., "html")
        publicId - optional
        systemId - optional
      • comment

        public  text)
        Adds the comment and returns this document for further construction.
        Since:
        5.1.0.0
      • raw

        public  text)
        Adds the raw text and returns this document for further construction.
        Since:
        5.1.0.0
      • text

        public  text)
        Adds and returns a new text node (the text node is returned so that Text.write(String) or [@link Text.writef(String, Object[]) may be invoked.
        Parameters:
        text - initial text for the node
        Returns:
        the new Text node
      • cdata

        public  content)
        Adds and returns a new CDATA node.
        Parameters:
        content - the content to be rendered by the node
        Returns:
        the newly created node
      • getMimeType

        public  getMimeType()
        Returns the MIME type of this document.
        Returns:
        the MIME type.
        Since:
        5.4