Document (interface)

The Document interface represents the entire XML Document.

  • contains methods that allow to set/get global document information

    DocumentType getDoctype()
  • since nodes cannot exist outside the Document and since the DOM API only consists of Interfaces, the Document class contains factory methods that allow for creation of these nodes

    Attr createAttribute( String name)
    Attr createAttributeNS( String namespaceURI, String qualifiedName)
    CDATASection createCDATASection( String data)
    Comment createComment( String data)
    Element createElement( String tagName)
    Element createElementNS( String namespaceURI, String qualifiedName)
    EntityReference createEntityReference( String name)
    Text createTextNode( String data)
  • provides access to the root-element

    Element getDocumentElement()
  • provides possibilities to query the document for specific elements

    Element getElementById( String elementId)
    NodeList getElementsByTagName(String tagname)
    NodeList getElementsByTagNameNS( String namespaceURI, String localName)
  • method to import nodes from other XML Documents

    Node importNode( Node importedNode, boolean deep)
  • method to get the DOM Implementation that handles this Document

    DOMImplementation getImplementation()