Class DocumentImpl
- java.lang.Object
-
- org.htmlunit.cyberneko.xerces.dom.NodeImpl
-
- org.htmlunit.cyberneko.xerces.dom.ChildNode
-
- org.htmlunit.cyberneko.xerces.dom.ParentNode
-
- org.htmlunit.cyberneko.xerces.dom.CoreDocumentImpl
-
- org.htmlunit.cyberneko.xerces.dom.DocumentImpl
-
- All Implemented Interfaces:
java.lang.Cloneable
,org.w3c.dom.Document
,org.w3c.dom.events.DocumentEvent
,org.w3c.dom.events.EventTarget
,org.w3c.dom.Node
,org.w3c.dom.NodeList
- Direct Known Subclasses:
HTMLDocumentImpl
public class DocumentImpl extends CoreDocumentImpl implements org.w3c.dom.events.DocumentEvent
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.
-
-
Field Summary
-
Fields inherited from class org.htmlunit.cyberneko.xerces.dom.CoreDocumentImpl
allowGrammarAccess, changes, errorChecking
-
Fields inherited from class org.htmlunit.cyberneko.xerces.dom.ParentNode
firstChild, fNodeListCache, ownerDocument
-
Fields inherited from class org.htmlunit.cyberneko.xerces.dom.ChildNode
nextSibling_, previousSibling_
-
Fields inherited from class org.htmlunit.cyberneko.xerces.dom.NodeImpl
DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, FIRSTCHILD, HASSTRING, ID, NORMALIZED, OWNED, ownerNode_, READONLY, SPECIFIED, SYNCCHILDREN
-
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
-
Constructor Summary
Constructors Constructor Description DocumentImpl()
NON-DOM: Actually creating a Document is outside the DOM's spec, since it has to operate in terms of a particular implementation.DocumentImpl(boolean grammarAccess)
Constructor.DocumentImpl(org.w3c.dom.DocumentType doctype)
For DOM2 support.DocumentImpl(org.w3c.dom.DocumentType doctype, boolean grammarAccess)
For DOM2 support.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.w3c.dom.Node
cloneNode(boolean deep)
Deep-clone a document, including fixing ownerDoc for the cloned children.org.w3c.dom.events.Event
createEvent(java.lang.String type)
Introduced in DOM Level 2.(package private) 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.org.w3c.dom.DOMImplementation
getImplementation()
Retrieve information describing the abilities of this particular DOM implementation.(package private) void
insertedNode(NodeImpl node, NodeImpl newInternal, boolean replace)
A method to be called when a node has been inserted in the tree.(package private) 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.(package private) void
insertingNode(NodeImpl node, boolean replace)
A method to be called when a node is about to be inserted in the tree.(package private) void
modifiedAttrValue(AttrImpl attr, java.lang.String oldvalue)
A method to be called when an attribute value has been modified(package private) void
modifiedCharacterData(NodeImpl node, java.lang.String oldvalue, java.lang.String value, boolean replace)
A method to be called when a character data node has been modified(package private) void
modifyingCharacterData(NodeImpl node, boolean replace)
A method to be called when a character data node is about to be modified(package private) void
removedAttrNode(AttrImpl attr, NodeImpl oldOwner, java.lang.String name)
A method to be called when an attribute node has been removed(package private) void
removedNode(NodeImpl node, boolean replace)
A method to be called when a node has been removed from the tree.(package private) void
removingNode(NodeImpl node, NodeImpl oldChild, boolean replace)
A method to be called when a node is about to be removed from the tree.(package private) void
renamedAttrNode(org.w3c.dom.Attr oldAt, org.w3c.dom.Attr newAt)
A method to be called when an attribute node has been renamed(package private) void
renamedElement(org.w3c.dom.Element oldEl, org.w3c.dom.Element newEl)
A method to be called when an element has been renamed(package private) void
replacedCharacterData(NodeImpl node, java.lang.String oldvalue, java.lang.String value)
method to be called when a character data node has been replaced.(package private) void
replacedNode(NodeImpl node)
A method to be called when a node has been replaced in the tree.(package private) 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.(package private) void
replacingData(NodeImpl node)
A method to be called when a character data node is about to be replaced(package private) void
replacingNode(NodeImpl node)
A method to be called when a node is about to be replaced in the tree.(package private) void
setAttrNode(AttrImpl attr, AttrImpl previous)
A method to be called when an attribute node has been set-
Methods inherited from class org.htmlunit.cyberneko.xerces.dom.CoreDocumentImpl
addEventListener, adoptNode, canRenameElements, changed, changes, checkDOMNSErr, checkNamespaceWF, checkQName, clearIdentifiers, clone, cloneNode, copyEventListeners, createAttribute, createAttributeNS, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createDocumentType, createElement, createElementNS, createElementNS, createEntity, createEntityReference, createProcessingInstruction, createTextNode, freeNodeListCache, getBaseURI, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getErrorChecking, getIdentifier, getInputEncoding, getNodeListCache, getNodeName, getNodeNumber, getNodeNumber, getNodeType, getOwnerDocument, getStrictErrorChecking, getTextContent, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, insertBefore, isKidOK, isValidQName, isXML11Version, isXMLName, normalizeDocument, putIdentifier, removeChild, removeEventListener, removeIdentifier, renameNode, replaceChild, setDocumentURI, setErrorChecking, setInputEncoding, setStrictErrorChecking, setTextContent, setXmlEncoding, setXmlStandalone, setXmlVersion, undeferChildren
-
Methods inherited from class org.htmlunit.cyberneko.xerces.dom.ParentNode
checkNormalizationAfterInsert, checkNormalizationAfterRemove, getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getTextContent, hasChildNodes, hasTextContent, internalInsertBefore, internalRemoveChild, isEqualNode, item, lastChild, nodeListGetLength, nodeListItem, ownerDocument, setOwnerDocument, synchronizeChildren
-
Methods inherited from class org.htmlunit.cyberneko.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling, parentNode, previousSibling
-
Methods inherited from class org.htmlunit.cyberneko.xerces.dom.NodeImpl
addEventListener, appendChild, compareDocumentPosition, dispatchEvent, getAttributes, getElementAncestor, getFeature, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getUserData, hasAttributes, hasStringValue, hasStringValue, isDefaultNamespace, isFirstChild, isFirstChild, isIdAttribute, isIdAttribute, isNormalized, isNormalized, isOwned, isOwned, isSameNode, isSpecified, isSpecified, isSupported, lookupNamespacePrefix, lookupNamespaceURI, lookupPrefix, needsSyncChildren, needsSyncChildren, normalize, removeEventListener, setNodeValue, setPrefix, setUserData, toString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.w3c.dom.Node
appendChild, compareDocumentPosition, getAttributes, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getParentNode, getPrefix, getPreviousSibling, getUserData, hasAttributes, hasChildNodes, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, setNodeValue, setPrefix, setUserData
-
-
-
-
Constructor Detail
-
DocumentImpl
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.
-
DocumentImpl
public DocumentImpl(boolean grammarAccess)
Constructor.- Parameters:
grammarAccess
- grammar access flag
-
DocumentImpl
public DocumentImpl(org.w3c.dom.DocumentType doctype)
For DOM2 support. The createDocument factory method is in DOMImplementation.- Parameters:
doctype
- theDocumentType
-
DocumentImpl
public DocumentImpl(org.w3c.dom.DocumentType doctype, boolean grammarAccess)
For DOM2 support.- Parameters:
doctype
- theDocumentType
grammarAccess
- grammar access flag
-
-
Method Detail
-
cloneNode
public org.w3c.dom.Node cloneNode(boolean deep)
Deep-clone a document, including fixing ownerDoc for the cloned children. Note that this requires bypassing the WRONG_DOCUMENT_ERR protection. I've chosen to implement it by calling importNode which is DOM Level 2. Deep-clone a document, including fixing ownerDoc for the cloned children. Note that this requires bypassing the WRONG_DOCUMENT_ERR protection. I've chosen to implement it by calling importNode which is DOM Level 2.- Specified by:
cloneNode
in interfaceorg.w3c.dom.Node
- Overrides:
cloneNode
in classCoreDocumentImpl
- Parameters:
deep
- boolean, iff true replicate children- Returns:
- org.w3c.dom.Node
- See Also:
Example: Cloning a Text node will copy both the node and the text it contains. Example: Cloning something that has children -- Element or Attr, for example -- will _not_ clone those children unless a "deep clone" has been requested. A shallow clone of an Attr node will yield an empty Attr of the same name. NOTE: Clones will always be read/write, even if the node being cloned is read-only, to permit applications using only the DOM API to obtain editable copies of locked portions of the tree.
-
getImplementation
public org.w3c.dom.DOMImplementation getImplementation()
Retrieve information describing the abilities of this particular DOM implementation. Intended to support applications that may be using DOMs retrieved from several different sources, potentially with different underlying representations. Retrieve information describing the abilities of this particular DOM implementation. Intended to support applications that may be using DOMs retrieved from several different sources, potentially with different underlying representations.- Specified by:
getImplementation
in interfaceorg.w3c.dom.Document
- Overrides:
getImplementation
in classCoreDocumentImpl
-
replacedText
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. A method to be called when some text was changed in a text node, so that live objects can be notified.- Overrides:
replacedText
in classCoreDocumentImpl
-
deletedText
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. A method to be called when some text was deleted from a text node, so that live objects can be notified.- Overrides:
deletedText
in classCoreDocumentImpl
-
insertedText
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. A method to be called when some text was inserted into a text node, so that live objects can be notified.- Overrides:
insertedText
in classCoreDocumentImpl
-
createEvent
public org.w3c.dom.events.Event createEvent(java.lang.String type) throws org.w3c.dom.DOMException
Introduced in DOM Level 2. Optional.Create and return Event objects.
- Specified by:
createEvent
in interfaceorg.w3c.dom.events.DocumentEvent
- Parameters:
type
- The 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.- Returns:
- Newly created Event
- Throws:
org.w3c.dom.DOMException
- NOT_SUPPORTED_ERR: Raised if the implementation does not support the type of Event interface requested
-
modifyingCharacterData
void modifyingCharacterData(NodeImpl node, boolean replace)
A method to be called when a character data node is about to be modified A method to be called when a character data node has been modified- Overrides:
modifyingCharacterData
in classCoreDocumentImpl
-
modifiedCharacterData
void modifiedCharacterData(NodeImpl node, java.lang.String oldvalue, java.lang.String value, boolean replace)
A method to be called when a character data node has been modified A method to be called when a character data node has been modified- Overrides:
modifiedCharacterData
in classCoreDocumentImpl
-
replacedCharacterData
void replacedCharacterData(NodeImpl node, java.lang.String oldvalue, java.lang.String value)
method to be called when a character data node has been replaced. A method to be called when a character data node has been replaced- Overrides:
replacedCharacterData
in classCoreDocumentImpl
-
insertingNode
void insertingNode(NodeImpl node, boolean replace)
A method to be called when a node is about to be inserted in the tree. A method to be called when a node is about to be inserted in the tree.- Overrides:
insertingNode
in classCoreDocumentImpl
-
insertedNode
void insertedNode(NodeImpl node, NodeImpl newInternal, boolean replace)
A method to be called when a node has been inserted in the tree. A method to be called when a node has been inserted in the tree.- Overrides:
insertedNode
in classCoreDocumentImpl
-
removingNode
void removingNode(NodeImpl node, NodeImpl oldChild, boolean replace)
A method to be called when a node is about to be removed from the tree. A method to be called when a node is about to be removed from the tree.- Overrides:
removingNode
in classCoreDocumentImpl
-
removedNode
void removedNode(NodeImpl node, boolean replace)
A method to be called when a node has been removed from the tree. A method to be called when a node has been removed from the tree.- Overrides:
removedNode
in classCoreDocumentImpl
-
replacingNode
void replacingNode(NodeImpl node)
A method to be called when a node is about to be replaced in the tree. A method to be called when a node is about to be replaced in the tree.- Overrides:
replacingNode
in classCoreDocumentImpl
-
replacingData
void replacingData(NodeImpl node)
A method to be called when a character data node is about to be replaced A method to be called when character data is about to be replaced in the tree.- Overrides:
replacingData
in classCoreDocumentImpl
-
replacedNode
void replacedNode(NodeImpl node)
A method to be called when a node has been replaced in the tree. A method to be called when a node has been replaced in the tree.- Overrides:
replacedNode
in classCoreDocumentImpl
-
modifiedAttrValue
void modifiedAttrValue(AttrImpl attr, java.lang.String oldvalue)
A method to be called when an attribute value has been modified A method to be called when an attribute value has been modified- Overrides:
modifiedAttrValue
in classCoreDocumentImpl
-
setAttrNode
void setAttrNode(AttrImpl attr, AttrImpl previous)
A method to be called when an attribute node has been set A method to be called when an attribute node has been set- Overrides:
setAttrNode
in classCoreDocumentImpl
-
removedAttrNode
void removedAttrNode(AttrImpl attr, NodeImpl oldOwner, java.lang.String name)
A method to be called when an attribute node has been removed A method to be called when an attribute node has been removed- Overrides:
removedAttrNode
in classCoreDocumentImpl
-
renamedAttrNode
void renamedAttrNode(org.w3c.dom.Attr oldAt, org.w3c.dom.Attr newAt)
A method to be called when an attribute node has been renamed A method to be called when an attribute node has been renamed- Overrides:
renamedAttrNode
in classCoreDocumentImpl
-
renamedElement
void renamedElement(org.w3c.dom.Element oldEl, org.w3c.dom.Element newEl)
A method to be called when an element has been renamed A method to be called when an element has been renamed- Overrides:
renamedElement
in classCoreDocumentImpl
-
-