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.
The CoreDocumentImpl class only implements the DOM Core. Additional modules are supported by the more complete DocumentImpl subclass.
Note
When any node in the document is serialized, the entire document is serialized along with it.
| Modifier and Type | Field and Description |
|---|---|
| protected String | actualEncoding
Experimental DOM Level 3 feature: Document actualEncoding |
| protected boolean | allowGrammarAccess
Allow grammar access. |
| protected int | changes
Number of alterations made to this document since its creation. |
| protected ElementImpl | docElement
Document element. |
| protected DocumentTypeImpl | docType
Document type. |
| private int | documentNumber
The following are required for compareDocumentPosition |
| pack-priv transient DOMNormalizer | |
| protected String | encoding
Experimental DOM Level 3 feature: Document encoding |
| protected boolean | errorChecking
Bypass error checking. |
| pack-priv transient DOMConfigurationImpl | |
| protected String | fDocumentURI
Experimental DOM Level 3 feature: documentURI |
| pack-priv transient NodeListCache | fFreeNLCache
NodeListCache free list |
| pack-priv transient Object | |
| protected Hashtable | identifiers
Identifiers. |
| private static final int[] | kidOK
Table for quick check of child insertion. |
| private int | |
| private Map | |
| pack-priv static final long | serialVersionUID
Serialization version.
|
| protected boolean | standalone
Experimental DOM Level 3 feature: Document standalone |
| protected Map | userData
Table for user data attached to this document nodes. |
| protected String | version
Experimental DOM Level 3 feature: Document version |
| private boolean | |
| protected boolean |
| Access | Constructor and Description |
|---|---|
| public | CoreDocumentImpl()
NON-DOM: Actually creating a Document is outside the DOM's spec, since it has to operate in terms of a particular implementation. |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| protected void | |
| public Node | adoptNode(Node
The node to adopt. source)Implements org. |
| protected void | callUserDataHandlers(Node
The node this operation applies to. n, Node The copy node or null. c, short The operation - import, clone, or delete. operation)Call user data handlers when a node is deleted (finalized) |
| pack-priv void | callUserDataHandlers(Node
The node this operation applies to. n, Node The copy node or null. c, short The operation - import, clone, or delete. operation, Hashtable<K, V> Data associated with n. userData)Call user data handlers when a node is deleted (finalized) |
| protected boolean | |
| protected void | |
| protected int | changes()
Overrides org. |
| protected final void | |
| protected final void | checkNamespaceWF(String qname, int colon1, int colon2)
Call user data handlers to let them know the nodes they are related to are being deleted. |
| protected final void | checkQName(String
prefix of qualified name prefix, String local part of qualified name local)Checks if the given qualified name is legal with respect to the version of XML to which this document must conform. |
| protected final void | |
| public Object | |
| public Node | Returns: org.w3c.dom.Nodeboolean, iff true replicate children deep)Overrides org. Implements org. |
| protected void | |
| protected void | |
| public Attr | createAttribute(String
The name of the attribute. Note that the attribute's value is
_not_ established at the factory; remember to set it! name)Implements org. |
| public Attr | Returns: Attr A new Attr object.The namespace URI of the attribute to
create. When it is null or an empty string,
this method behaves like createAttribute. namespaceURI, String The qualified name of the attribute to
instantiate. qualifiedName)Implements org. |
| public Attr | Returns: Attr A new Attr object.The namespace URI of the attribute to
create. When it is null or an empty string,
this method behaves like createAttribute. namespaceURI, String The qualified name of the attribute to
instantiate. qualifiedName, String The local name of the attribute to instantiate. localpart)NON-DOM: a factory method used by the Xerces DOM parser to create an element. |
| public CDATASection | createCDATASection(String
The initial contents of the CDATA data)Implements org. |
| public Comment | createComment(String
The initial contents of the Comment. data)Implements org. |
| public DocumentFragment | createDocumentFragment()
Implements org. |
| public DocumentType | createDocumentType(String qualifiedName, String publicID, String systemID)
NON-DOM Factory method; creates a DocumentType having this Document as its OwnerDoc. |
| public Element | createElement(String
The name of the element type to instantiate. For
XML, this is case-sensitive. For HTML, the tagName parameter may
be provided in any case, but it must be mapped to the canonical
uppercase form by the DOM implementation. tagName)Implements org. |
| public ElementDefinitionImpl | |
| public Element | Returns: Element A new Element object with the following attributes:The namespace URI of the element to
create. namespaceURI, String The qualified name of the element type to
instantiate. qualifiedName)Implements org. |
| public Element | Returns: Element A new Element object with the following attributes:The namespace URI of the element to
create. namespaceURI, String The qualified name of the element type to
instantiate. qualifiedName, String The local name of the attribute to instantiate. localpart)NON-DOM: a factory method used by the Xerces DOM parser to create an element. |
| public Entity | createEntity(String
The name of the Entity we wish to provide a value for. name)NON-DOM Factory method; creates an Entity having this Document as its OwnerDoc. |
| public EntityReference | createEntityReference(String
The name of the Entity we wish to refer to name)Implements org. |
| public Notation | createNotation(String
The name of the Notation we wish to describe name)NON-DOM Factory method; creates a Notation having this Document as its OwnerDoc. |
| public ProcessingInstruction | createProcessingInstruction(String
The target "processor channel" target, String Parameter string to be passed to the target. data)Implements org. |
| public Text | createTextNode(String
The initial contents of the Text. data)Implements org. |
| pack-priv void | deletedText(CharacterDataImpl node, int offset, int count)
A method to be called when some text was deleted from a text node, so that live objects can be notified. |
| protected boolean | |
| pack-priv void | |
| public boolean | |
| public String | Returns: The absolute base URI of this node or null.Overrides org. Implements org. |
| public DocumentType | getDoctype()
Implements org. |
| public Element | getDocumentElement()
Implements org. |
| public String | |
| public DOMConfiguration | getDomConfig()
Implements org. Document.normalizeDocument is
invoked.
|
| public Element | getElementById(String
The unique elementId)id value for an element.Implements org. |
| public NodeList | getElementsByTagName(String
The type of Element we want to gather. "*" will be
taken as a wildcard, meaning "all elements in the document." tagname)Implements org. |
| public NodeList | Returns: NodeList A new NodeList object containing all the matched Elements.The namespace URI of the elements to match
on. The special value "*" matches all
namespaces. When it is null or an empty
string, this method behaves like
getElementsByTagName. namespaceURI, String The local name of the elements to match on.
The special value "*" matches all local names. localName)Implements org. |
| public String | getEncoding()
Deprecated
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
|
| public boolean | |
| public Object | getFeature(String
The name of the feature requested. Note that any plus
sign "+" prepended to the name of the feature will be ignored since
it is not significant in the context of this method. feature, String This is the version number of the feature to test. version)Overrides org. Implements org. |
| public Element | getIdentifier(String idName)
Returns a previously registered element with the specified identifier name, or null if no element is registered. |
| public Enumeration | |
| public DOMImplementation | getImplementation()
Implements org. |
| public String | |
| pack-priv boolean | |
| pack-priv NodeListCache | |
| public String | getNodeName()
Implements abstract org. Implements org. |
| protected int | getNodeNumber()
Overrides org. |
| protected int | getNodeNumber(Node node)
NON-DOM: Get a number associated with a node created with respect to this document. |
| public short | getNodeType()
Implements abstract org. Implements org. |
| public final Document | getOwnerDocument()
Overrides org. Implements org. Document object associated with this node.
|
| public boolean | getStandalone()
Deprecated
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
|
| public boolean | getStrictErrorChecking()
Implements org. |
| public String | getTextContent()
Overrides org. Implements org. |
| public Object | Returns: Returns theDOMObject associated to the given key
on this node, or null if there was none.The node the object is associated to. n, String The key the object is associated to. key)Retrieves the object associated to a key on a this node. |
| protected Object | getUserData(NodeImpl n)
NON-DOM: kept for backward compatibility Retreive user data related to a given node |
| protected Hashtable | |
| public String | getVersion()
Deprecated
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
|
| public String | |
| public boolean | |
| public String | |
| public Node | importNode(Node
The node to import. source, boolean If deep)true, recursively import the subtree under
the specified node; if false, import only the node
itself, as explained above. This has no effect on nodes that cannot
have any children, and on Attr, and
EntityReference nodes.Implements org. |
| private Node | importNode(Node source, boolean deep, boolean cloningDoc, HashMap<K, V> reversedIdentifiers)
Overloaded implementation of DOM's importNode method. |
| public Node | insertBefore(Node
The node to insert. newChild, Node The reference node, i.e., the node before which the
new node must be inserted. refChild)Overrides org. Implements org. |
| pack-priv void | insertedNode(NodeImpl node, NodeImpl newInternal, boolean replace)
A method to be called when a node has been inserted in the tree. |
| pack-priv void | insertedText(CharacterDataImpl node, int offset, int count)
A method to be called when some text was inserted into a text node, so that live objects can be notified. |
| pack-priv void | insertingNode(NodeImpl node, boolean replace)
A method to be called when a node is about to be inserted in the tree. |
| protected boolean | |
| pack-priv boolean | |
| public static final boolean | isValidQName(String
prefix of qualified name prefix, String local part of qualified name local, boolean xml11Version)Checks if the given qualified name is legal with respect to the version of XML to which this document must conform. |
| pack-priv boolean | isXML11Version()
We could have more xml versions in future , but for now we could do with this to handle XML 1.0 and 1.1 |
| public static final boolean | |
| pack-priv boolean | |
| public boolean | Returns: If async is set totrue load returns
true if the document load was successfully initiated.
If an error occurred when initiating the document load,
load returns false.If async is set to
false load returns true if
the document was successfully loaded and parsed. If an error
occurred when either loading or parsing the URI, load
returns false.The URI reference for the XML file to be loaded. If this is
a relative URI, the base URI used by the implementation is
implementation dependent. uri)DOM Level 3 WD - Experimental. |
| public boolean | |
| pack-priv void | modifiedAttrValue(AttrImpl attr, String oldvalue)
A method to be called when an attribute value has been modified |
| pack-priv void | modifiedCharacterData(NodeImpl node, String oldvalue, String value, boolean replace)
A method to be called when a character data node has been modified |
| pack-priv void | modifyingCharacterData(NodeImpl node, boolean replace)
A method to be called when a character data node is about to be modified |
| public void | normalizeDocument()
Implements org. |
| public void | putIdentifier(String idName, Element element)
Registers an identifier name with a specified element node. |
| private void | readObject(ObjectInputStream in)
The serialized forms of the user data and node table
maps are Hashtables.
|
| public Node | removeChild(Node
The node being removed. oldChild)Overrides org. Implements org. |
| pack-priv void | removedAttrNode(AttrImpl attr, NodeImpl oldOwner, String name)
A method to be called when an attribute node has been removed |
| pack-priv void | removedNode(NodeImpl node, boolean replace)
A method to be called when a node has been removed from the tree. |
| protected void | |
| public void | removeIdentifier(String idName)
Removes a previously registered element with the specified identifier name. |
| pack-priv Hashtable | Returns: The removed table.The node this operation applies to. n)Remove user data table for the given node. |
| pack-priv void | removingNode(NodeImpl node, NodeImpl oldChild, boolean replace)
A method to be called when a node is about to be removed from the tree. |
| pack-priv void | renamedAttrNode(Attr oldAt, Attr newAt)
A method to be called when an attribute node has been renamed |
| pack-priv void | |
| public Node | renameNode(Node
The node to rename. n, String The new namespace URI. namespaceURI, String The new qualified name. name)Implements org. |
| public Node | replaceChild(Node
The new node to put in the child list. newChild, Node The node being replaced in the list. oldChild)Overrides org. Implements org. |
| pack-priv void | replacedCharacterData(NodeImpl node, String oldvalue, String value)
method to be called when a character data node has been replaced. |
| pack-priv void | |
| pack-priv void | replacedText(CharacterDataImpl node)
A method to be called when some text was changed in a text node, so that live objects can be notified. |
| private ElementImpl | |
| pack-priv void | replacingData(NodeImpl node)
A method to be called when a character data node is about to be replaced |
| pack-priv void | |
| public String | |
| public void | |
| pack-priv void | setAttrNode(AttrImpl attr, AttrImpl previous)
A method to be called when an attribute node has been set |
| public void | setDocumentURI(String documentURI)
Implements org. |
| public void | setEncoding(String value)
Deprecated
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
|
| public void | setErrorChecking(boolean check)
Sets whether the DOM implementation performs error checking upon operations. |
| public void | setInputEncoding(String value)
DOM Internal (Was a DOM L3 Core WD public interface method setActualEncoding ) An attribute specifying the actual encoding of this document. |
| pack-priv void | setMutationEvents(boolean set)
Sets whether the DOM implementation generates mutation events upon operations. |
| public void | setStandalone(boolean value)
Deprecated
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
|
| public void | setStrictErrorChecking(boolean check)
Implements org. |
| public void | setTextContent(String textContent)
Overrides org. Implements org. |
| public Object | Returns: Returns theDOMObject previously associated to
the given key on this node, or null if there was none.The node to associate the object to. n, String The key to associate the object to. key, Object The object to associate to the given key, or
data, UserDataHandler null to remove any existing association to that key.The handler to associate to that key, or
handler)null.Associate an object to a key on this node. |
| protected void | setUserData(NodeImpl n, Object data)
NON-DOM: kept for backward compatibility Store user data related to a given node This is a place where we could use weak references! |
| pack-priv void | setUserDataTable(Node
The node this operation applies to. n, Hashtable<K, V> The user data table. data)Set user data table for the given node. |
| public void | setVersion(String value)
Deprecated
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
|
| public void | setXmlEncoding(String value)
DOM Internal (Was a DOM L3 Core WD public interface method setXMLEncoding ) An attribute specifying, as part of the XML declaration, the encoding of this document. |
| public void | setXmlStandalone(boolean value)
Implements org. |
| public void | setXmlVersion(String value)
Implements org. |
| protected void | |
| private void | writeObject(ObjectOutputStream out)
To allow DOM trees serialized by newer versions of Xerces
to be read by older versions briefly move the user data
and node table into Hashtables.
|