|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||


public interface Document

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.
| Field Summary |
|---|
Fields inherited from interface org.w3c.dom.Node ![]() |
|---|
ATTRIBUTE_NODE |
| Method Summary | |
|---|---|
Node |
adoptNode
Attempts to adopt a node from another document to this document. |
Attr |
createAttribute
Creates an Attr of the given name. |
Attr |
createAttributeNS
Creates an attribute of the given qualified name and namespace URI. |
CDATASection |
createCDATASection
Creates a CDATASection node whose value is the specified
string. |
Comment |
createComment
Creates a Comment node given the specified string. |
DocumentFragment |
createDocumentFragment
Creates an empty DocumentFragment object. |
Element |
createElement
Creates an element of the type specified. |
Element |
createElementNS
Creates an element of the given qualified name and namespace URI. |
EntityReference |
createEntityReference
Creates an EntityReference object. |
ProcessingInstruction |
createProcessingInstruction
Creates a ProcessingInstruction node given the specified
name and data strings. |
Text |
createTextNode
Creates a Text node given the specified string. |
DocumentType |
getDoctype
The Document Type Declaration (see DocumentType)
associated with this document. |
Element |
getDocumentElement
This is a convenience attribute that allows direct access to the child node that is the document element of the document. |
String |
getDocumentURI
The location of the document or null if undefined or if
the Document was created using
DOMImplementation.createDocument. |
DOMConfiguration |
getDomConfig
The configuration used when Document.normalizeDocument()
is invoked. |
Element |
getElementById
Returns the Element that has an ID attribute with the
given value. |
NodeList |
getElementsByTagName
Returns a NodeList of all the Elements in
document order with a given tag name and are contained in the
document. |
NodeList |
getElementsByTagNameNS
Returns a NodeList of all the Elements with a
given local name and namespace URI in document order. |
DOMImplementation |
getImplementation
The DOMImplementation object that handles this document. |
String |
getInputEncoding
An attribute specifying the encoding used for this document at the time of the parsing. |
boolean |
getStrictErrorChecking
An attribute specifying whether error checking is enforced or not. |
String |
getXmlEncoding
An attribute specifying, as part of the XML declaration, the encoding of this document. |
boolean |
getXmlStandalone
An attribute specifying, as part of the XML declaration, whether this document is standalone. |
String |
getXmlVersion
An attribute specifying, as part of the XML declaration, the version number of this document. |
Node |
importNode
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. |
void |
normalizeDocument
This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form. |
Node |
renameNode
Rename an existing node of type ELEMENT_NODE or
ATTRIBUTE_NODE. |
void |
setDocumentURI
The location of the document or null if undefined or if
the Document was created using
DOMImplementation.createDocument. |
void |
setStrictErrorChecking
An attribute specifying whether error checking is enforced or not. |
void |
setXmlStandalone
An attribute specifying, as part of the XML declaration, whether this document is standalone. |
void |
setXmlVersion
An attribute specifying, as part of the XML declaration, the version number of this document. |
Methods inherited from interface org.w3c.dom.Node ![]() |
|---|
appendChild |
| Method Detail |
|---|

DocumentType![]()
![]()
getDoctype()
DocumentType)
associated with this document. For XML documents without a document
type declaration this returns null. For HTML documents,
a DocumentType object may be returned, independently of
the presence or absence of document type declaration in the HTML
document.
DocumentType node,
child node of this Document. This node can be set at
document creation time and later changed through the use of child
nodes manipulation methods, such as Node.insertBefore,
or Node.replaceChild. Note, however, that while some
implementations may instantiate different types of
Document objects supporting additional features than the
"Core", such as "HTML" [DOM Level 2 HTML]
, based on the DocumentType specified at creation time,
changing it afterwards is very unlikely to result in a change of the
features supported.

DOMImplementation![]()
![]()
getImplementation()
DOMImplementation object that handles this document. A
DOM application may use objects from multiple implementations.

Element![]()
![]()
getDocumentElement()

Element![]()
![]()
createElement(String
![]()
![]()
tagName) throws DOMException
![]()
![]()
Element interface, so attributes
can be specified directly on the returned object.
Attr nodes representing them are automatically created
and attached to the element.
createElementNS method.
tagName - The name of the element type to instantiate. For XML,
this is case-sensitive, otherwise it depends on the
case-sensitivity of the markup language in use. In that case, the
name is mapped to the canonical form of that markup by the DOM
implementation.
Element object with the
nodeName attribute set to tagName, and
localName, prefix, and
namespaceURI set to null.
DOMException

- INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
name according to the XML version in use specified in the
Document.xmlVersion attribute.

DocumentFragment![]()
![]()
createDocumentFragment()
DocumentFragment object.
DocumentFragment.

Text![]()
![]()
createTextNode(String
![]()
![]()
data)
Text node given the specified string.
data - The data for the node.
Text object.

Comment![]()
![]()
createComment(String
![]()
![]()
data)
Comment node given the specified string.
data - The data for the node.
Comment object.

CDATASection![]()
![]()
createCDATASection(String
![]()
![]()
data) throws DOMException
![]()
![]()
CDATASection node whose value is the specified
string.
data - The data for the CDATASection contents.
CDATASection object.
DOMException

- NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

ProcessingInstruction![]()
![]()
createProcessingInstruction(String
![]()
![]()
target, String
![]()
![]()
data) throws DOMException
![]()
![]()
ProcessingInstruction node given the specified
name and data strings.
target - The target part of the processing instruction.Unlike
Document.createElementNS or
Document.createAttributeNS, no namespace well-formed
checking is done on the target name. Applications should invoke
Document.normalizeDocument() with the parameter "
namespaces" set to true in order to ensure that the
target name is namespace well-formed.data - The data for the node.
ProcessingInstruction object.
DOMException
