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 DocumentImpl class also implements the DOM Level 2 DocumentTraversal interface. This interface is comprised of factory methods needed to create NodeIterators and TreeWalkers. The process of creating NodeIterator objects also adds these references to this document. After finishing with an iterator it is important to remove the object using the remove methods in this implementation. This allows the release of the references from the iterator objects to the DOM Nodes.
Note
When any node in the document is serialized, the entire document is serialized along with it.
Modifier and Type | Class and Description |
---|---|
pack-priv class | DocumentImpl.
NON-DOM INTERNAL: Return object for getEnclosingAttr. |
pack-priv class |
Modifier and Type | Field and Description |
---|---|
protected Map | eventListeners
Table for event listeners registered to this document nodes. |
protected List | iterators
Iterators |
protected boolean | mutationEvents
Bypass mutation events firing. |
protected List | ranges
Ranges |
pack-priv DocumentImpl. | |
private static final ObjectStreamField[] | |
pack-priv static final long | serialVersionUID
Hides com. |
Access | Constructor and Description |
---|---|
public | DocumentImpl()
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 |
---|---|
protected void | addEventListener(NodeImpl
node to add listener to node, String Event name (NOT event group!) to listen for. type, EventListener Who gets called when event is dispatched listener, boolean True iff listener is registered on
capturing phase rather than at-target or bubbling useCapture)Overrides com. Introduced in DOM Level 2. |
public Node | Returns: org.w3c.dom.Nodeboolean, iff true replicate children deep)Overrides com. Implements org. Deep-clone a document, including fixing ownerDoc for the cloned children. |
protected void | |
public Event | Returns: Newly created EventThe eventType parameter specifies the type of Event
interface to be created. If the Event interface specified is supported
by the implementation this method will return a new Event of the
interface type requested. If the Event is to be dispatched via the
dispatchEvent method the appropriate event init method must be called
after creation in order to initialize the Event's values. As an
example, a user wishing to synthesize some kind of Event would call
createEvent with the parameter "Events". The initEvent method could then
be called on the newly created Event to set the specific type of Event
to be dispatched and set its context information. type)Implements org. Introduced in DOM Level 2. |
public NodeIterator | createNodeIterator(Node
The root of the iterator. root, short The whatToShow mask. whatToShow, NodeFilter The NodeFilter installed. Null means no filter. filter)NON-DOM extension: Create and return a NodeIterator. |
public NodeIterator | createNodeIterator(Node
The root of the iterator. root, int The whatToShow mask. whatToShow, NodeFilter The NodeFilter installed. Null means no filter. filter, boolean true to expand the contents of
EntityReference nodes entityReferenceExpansion)Implements org. Create and return a NodeIterator. |
public Range | createRange()
Implements org. This interface can be obtained from the object implementing the
|
public TreeWalker | createTreeWalker(Node
The root of the iterator. root, short The whatToShow mask. whatToShow, NodeFilter The NodeFilter installed. Null means no filter. filter)NON-DOM extension: Create and return a TreeWalker. |
public TreeWalker | createTreeWalker(Node
The root of the iterator. root, int The whatToShow mask. whatToShow, NodeFilter The NodeFilter installed. Null means no filter. filter, boolean true to expand the contents of
EntityReference nodes entityReferenceExpansion)Implements org. Create and return a TreeWalker. |
pack-priv void | deletedText(NodeImpl node, int offset, int count)
Overrides com. A method to be called when some text was deleted from a text node, so that live objects can be notified. |
protected void | dispatchAggregateEvents(NodeImpl
node to dispatch to node, DocumentImpl.description of Attr affected by current operation eaNON-DOM INTERNAL: Convenience wrapper for calling
dispatchAggregateEvents when the context was established
by |
protected void | dispatchAggregateEvents(NodeImpl
The node to dispatch to node, AttrImpl The Attr node (if any) whose value has been changed
as a result of the DOM operation. Null if none such. enclosingAttr, String The String value previously held by the
enclosingAttr. Ignored if none such. oldvalue, short Type of modification to the attr. See
MutationEvent.attrChange change)NON-DOM INTERNAL: Generate the "aggregated" post-mutation events DOMAttrModified and DOMSubtreeModified. |
protected boolean | Returns: true if the event'spreventDefault()
method was invoked by an EventListener; otherwise false.node to dispatch to node, Event the event object to be dispatched to
registered EventListeners event)Overrides com. Introduced in DOM Level 2. |
protected void | dispatchEventToSubtree(Node
target node (that was directly inserted or removed) n, Event event to be sent to that node and its subtree e)NON-DOM INTERNAL: DOMNodeInsertedIntoDocument and ...RemovedFrom... |
protected void | dispatchingEventToSubtree(Node
node to dispatch to n, Event event to be sent to that node and its subtree e)Dispatches event to the target node's descendents recursively |
protected List | |
public DOMImplementation | getImplementation()
Overrides com. Implements org. Retrieve information describing the abilities of this particular DOM implementation. |
pack-priv boolean | getMutationEvents()
Overrides com. Returns true if the DOM implementation generates mutation events. |
pack-priv void | insertedNode(NodeImpl node, NodeImpl newInternal, boolean replace)
Overrides com. A method to be called when a node has been inserted in the tree. |
pack-priv void | insertedText(NodeImpl node, int offset, int count)
Overrides com. 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)
Overrides com. A method to be called when a node is about to be inserted in the tree. |
pack-priv void | modifiedAttrValue(AttrImpl attr, String oldvalue)
Overrides com. A method to be called when an attribute value has been modified |
pack-priv void | modifiedCharacterData(NodeImpl node, String oldvalue, String value, boolean replace)
Overrides com. A method to be called when a character data node has been modified |
pack-priv void | modifyingCharacterData(NodeImpl node, boolean replace)
Overrides com. A method to be called when a character data node has been modified |
private void | readObject(ObjectInputStream in)
Hides com. Deserialize object. |
pack-priv void | removedAttrNode(AttrImpl attr, NodeImpl oldOwner, String name)
Overrides com. A method to be called when an attribute node has been removed |
pack-priv void | removedNode(NodeImpl node, boolean replace)
Overrides com. A method to be called when a node has been removed from the tree. |
protected void | removeEventListener(NodeImpl
node to remove listener from node, String Event name (NOT event group!) to listen for. type, EventListener Who gets called when event is dispatched listener, boolean True iff listener is registered on
capturing phase rather than at-target or bubbling useCapture)Overrides com. Introduced in DOM Level 2. |
pack-priv void | |
pack-priv void | |
pack-priv void | removingNode(NodeImpl node, NodeImpl oldChild, boolean replace)
Overrides com. A method to be called when a node is about to be removed from the tree. |
pack-priv void | renamedAttrNode(Attr oldAt, Attr newAt)
Overrides com. A method to be called when an attribute node has been renamed |
pack-priv void | renamedElement(Element oldEl, Element newEl)
Overrides com. A method to be called when an element has been renamed |
pack-priv void | replacedCharacterData(NodeImpl node, String oldvalue, String value)
Overrides com. A method to be called when a character data node has been replaced |
pack-priv void | replacedNode(NodeImpl node)
Overrides com. A method to be called when a node has been replaced in the tree. |
pack-priv void | replacedText(NodeImpl node)
Overrides com. A method to be called when some text was changed in a text node, so that live objects can be notified. |
pack-priv void | replacingData(NodeImpl node)
Overrides com. A method to be called when character data is about to be replaced in the tree. |
pack-priv void | replacingNode(NodeImpl node)
Overrides com. A method to be called when a node is about to be replaced in the tree. |
protected void | Returns: either a description of that Attr, or null if none such.node to get enclosing attribute for node)NON-DOM INTERNAL: Pre-mutation context check, in preparation for later generating DOMAttrModified events. |
pack-priv void | setAttrNode(AttrImpl attr, AttrImpl previous)
Overrides com. A method to be called when an attribute node has been set |
protected void | setEventListeners(NodeImpl n, List<DocumentImpl.
Store event listener registered on a given node This is another place where we could use weak references! |
pack-priv void | setMutationEvents(boolean set)
Overrides com. Sets whether the DOM implementation generates mutation events upon operations. |
pack-priv void | |
private void | writeObject(ObjectOutputStream out)
Hides com. Serialize object. |