Document

public interface Document implements Node

The Document interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.

Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of a Document, the Document interface also contains the factory methods needed to create these objects. The Node objects created have a ownerDocument attribute which associates them with the Document within whose context they were created.

See also the Document Object Model (DOM) Level 3 Core Specification.

Inherited Constant Summary

Public Method Summary

abstract Node
adoptNode(Node source)
Attempts to adopt a node from another document to this document.
abstract Attr
createAttribute(String name)
Creates an Attr of the given name.
abstract Attr
createAttributeNS(String namespaceURI, String qualifiedName)
Creates an attribute of the given qualified name and namespace URI.
abstract CDATASection
createCDATASection(String data)
Creates a CDATASection node whose value is the specified string.
abstract Comment
createComment(String data)
Creates a Comment node given the specified string.
abstract DocumentFragment
createDocumentFragment()
Creates an empty DocumentFragment object.
abstract Element
createElement(String tagName)
Creates an element of the type specified.
abstract Element
createElementNS(String namespaceURI, String qualifiedName)
Creates an element of the given qualified name and namespace URI.
abstract EntityReference
createEntityReference(String name)
Creates an EntityReference object.
abstract ProcessingInstruction
createProcessingInstruction(String target, String data)
Creates a ProcessingInstruction node given the specified name and data strings.
abstract Text
createTextNode(String data)
Creates a Text node given the specified string.
abstract DocumentType
getDoctype()
The Document Type Declaration (see DocumentType) associated with this document.
abstract Element
getDocumentElement()
This is a convenience attribute that allows direct access to the child node that is the document element of the document.
abstract String
getDocumentURI()
The location of the document or null if undefined or if the Document was created using DOMImplementation.createDocument.
abstract DOMConfiguration
getDomConfig()
The configuration used when Document.normalizeDocument() is invoked.
abstract Element
getElementById(String elementId)
Returns the Element that has an ID attribute with the given value.
abstract NodeList
getElementsByTagName(String tagname)
Returns a NodeList of all the Elements in document order with a given tag name and are contained in the document.
abstract NodeList
getElementsByTagNameNS(String namespaceURI, String localName)
Returns a NodeList of all the Elements with a given local name and namespace URI in document order.
abstract DOMImplementation
getImplementation()
The DOMImplementation object that handles this document.
abstract String
getInputEncoding()
An attribute specifying the encoding used for this document at the time of the parsing.
abstract boolean
getStrictErrorChecking()
An attribute specifying whether error checking is enforced or not.
abstract String
getXmlEncoding()
An attribute specifying, as part of the XML declaration, the encoding of this document.
abstract boolean
getXmlStandalone()
An attribute specifying, as part of the XML declaration, whether this document is standalone.
abstract String
getXmlVersion()
An attribute specifying, as part of the XML declaration, the version number of this document.
abstract Node
importNode(Node importedNode, boolean deep)
Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node.
abstract void
normalizeDocument()
This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form.
abstract