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.EnclosingAttr
NON-DOM INTERNAL: Return object for getEnclosingAttr. |
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| protected Hashtable | eventListeners
Table for event listeners registered to this document nodes. |
| protected transient ReferenceQueue | iteratorReferenceQueue
Reference queue for cleared Node Iterator references |
| protected transient List | iterators
Node Iterators |
| protected boolean | mutationEvents
Bypass mutation events firing. |
| protected transient ReferenceQueue | rangeReferenceQueue
Reference queue for cleared Range references |
| protected transient List | ranges
Ranges |
| pack-priv DocumentImpl. | |
| pack-priv static final long | serialVersionUID
Hides org. |
| 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 org. |
| public Node | Returns: org.w3c.dom.Nodeboolean, iff true replicate children deep)Overrides org. Implements org. |
| protected void | copyEventListeners(NodeImpl src, NodeImpl tgt)
Overrides org. |
| 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. |
| 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. |
| public Range | createRange()
Implements org. Document interface using binding-specific casting
methods.
|
| 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. |
| pack-priv void | deletedText(CharacterDataImpl node, int offset, int count)
Overrides org. |
| 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 org. |
| 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 Vector | |
| public DOMImplementation | getImplementation()
Overrides org. Implements org. |
| pack-priv boolean | getMutationEvents()
Overrides org. |
| pack-priv void | insertedNode(NodeImpl node, NodeImpl newInternal, boolean replace)
Overrides org. |
| pack-priv void | insertedText(CharacterDataImpl node, int offset, int count)
Overrides org. |
| pack-priv void | insertingNode(NodeImpl node, boolean replace)
Overrides org. |
| pack-priv void | modifiedAttrValue(AttrImpl attr, String oldvalue)
Overrides org. |
| pack-priv void | modifiedCharacterData(NodeImpl node, String oldvalue, String value, boolean replace)
Overrides org. |
| pack-priv void | modifyingCharacterData(NodeImpl node, boolean replace)
Overrides org. |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| pack-priv void | removedAttrNode(AttrImpl attr, NodeImpl oldOwner, String name)
Overrides org. |
| pack-priv void | removedNode(NodeImpl node, boolean replace)
Overrides org. |
| 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 org. |
| pack-priv void | |
| pack-priv void | |
| private void | |
| private void | |
| private void | removeStaleReferences(ReferenceQueue<T> queue, List<E> list)
Remove stale references from the given list. |
| pack-priv void | removingNode(NodeImpl node, NodeImpl oldChild, boolean replace)
Overrides org. |
| pack-priv void | renamedAttrNode(Attr oldAt, Attr newAt)
Overrides org. |
| pack-priv void | renamedElement(Element oldEl, Element newEl)
Overrides org. |
| pack-priv void | replacedCharacterData(NodeImpl node, String oldvalue, String value)
Overrides org. |
| pack-priv void | replacedNode(NodeImpl node)
Overrides org. |
| pack-priv void | replacedText(CharacterDataImpl node)
Overrides org. |
| pack-priv void | replacingData(NodeImpl node)
Overrides org. |
| pack-priv void | replacingNode(NodeImpl node)
Overrides org. |
| protected void | saveEnclosingAttr(NodeImpl
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 org. |
| protected void | setEventListeners(NodeImpl n, Vector<E> listeners)
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 org. |
| pack-priv void |