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:
Cloneable,Document,DocumentEvent,EventTarget,Node,NodeList
- Direct Known Subclasses:
HTMLDocumentImpl
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.
- Author:
- Arnaud Le Hors, IBM, Joe Kesselman, IBM, Andy Clark, IBM, Ralf Pfeiffer, IBM
-
Field Summary
Fields inherited from class org.htmlunit.cyberneko.xerces.dom.CoreDocumentImpl
allowGrammarAccess, changes, errorCheckingFields inherited from class org.htmlunit.cyberneko.xerces.dom.ParentNode
firstChild, fNodeListCache, ownerDocumentFields 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, SYNCCHILDRENFields 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
ConstructorsConstructorDescriptionNON-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(DocumentType doctype) For DOM2 support.DocumentImpl(DocumentType doctype, boolean grammarAccess) For DOM2 support. -
Method Summary
Modifier and TypeMethodDescriptioncloneNode(boolean deep) Deep-clone a document, including fixing ownerDoc for the cloned children.createEvent(String type) Introduced in DOM Level 2.Retrieve information describing the abilities of this particular DOM implementation.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, getBaseURI, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getErrorChecking, getIdentifier, getInputEncoding, getNodeName, getNodeNumber, getNodeNumber, getNodeType, getOwnerDocument, getStrictErrorChecking, getTextContent, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, insertBefore, isKidOK, isValidQName, isXMLName, normalizeDocument, putIdentifier, removeChild, removeEventListener, removeIdentifier, renameNode, replaceChild, setDocumentURI, setErrorChecking, setInputEncoding, setStrictErrorChecking, setTextContent, setXmlEncoding, setXmlStandalone, setXmlVersion, undeferChildrenMethods inherited from class org.htmlunit.cyberneko.xerces.dom.ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, hasChildNodes, isEqualNode, item, setOwnerDocument, synchronizeChildrenMethods inherited from class org.htmlunit.cyberneko.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSiblingMethods inherited from class org.htmlunit.cyberneko.xerces.dom.NodeImpl
addEventListener, appendChild, compareDocumentPosition, dispatchEvent, getAttributes, getFeature, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getUserData, hasAttributes, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, normalize, removeEventListener, setNodeValue, setPrefix, setUserData, toStringMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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 Details
-
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
For DOM2 support. The createDocument factory method is in DOMImplementation.- Parameters:
doctype- theDocumentType
-
DocumentImpl
For DOM2 support.- Parameters:
doctype- theDocumentTypegrammarAccess- grammar access flag
-
-
Method Details
-
cloneNode
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:
cloneNodein interfaceNode- Overrides:
cloneNodein classCoreDocumentImpl- Parameters:
deep- boolean, iff true replicate children- Returns:
- org.w3c.dom.Node
- See Also:
-
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:
getImplementationin interfaceDocument- Overrides:
getImplementationin classCoreDocumentImpl
-
createEvent
Introduced in DOM Level 2. Optional.Create and return Event objects.
- Specified by:
createEventin interfaceDocumentEvent- 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:
DOMException- NOT_SUPPORTED_ERR: Raised if the implementation does not support the type of Event interface requested
-