Class DocumentImpl

All Implemented Interfaces:
Cloneable, Document, DocumentEvent, EventTarget, Node, NodeList
Direct Known Subclasses:
HTMLDocumentImpl

public class DocumentImpl extends CoreDocumentImpl implements 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.

  • 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

      public DocumentImpl(DocumentType doctype)
      For DOM2 support. The createDocument factory method is in DOMImplementation.
      Parameters:
      doctype - the DocumentType
    • DocumentImpl

      public DocumentImpl(DocumentType doctype, boolean grammarAccess)
      For DOM2 support.
      Parameters:
      doctype - the DocumentType
      grammarAccess - grammar access flag
  • Method Details

    • cloneNode

      public 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 interface Node
      Overrides:
      cloneNode in class CoreDocumentImpl
      Parameters:
      deep - boolean, iff true replicate children
      Returns:
      org.w3c.dom.Node
      See Also:
    • getImplementation

      public 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 interface Document
      Overrides:
      getImplementation in class CoreDocumentImpl
    • 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 class CoreDocumentImpl
    • 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 class CoreDocumentImpl
    • 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 class CoreDocumentImpl
    • createEvent

      public Event createEvent(String type) throws DOMException
      Introduced in DOM Level 2. Optional.

      Create and return Event objects.

      Specified by:
      createEvent in interface 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:
      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 class CoreDocumentImpl
    • modifiedCharacterData

      void modifiedCharacterData(NodeImpl node, String oldvalue, 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 class CoreDocumentImpl
    • replacedCharacterData

      void replacedCharacterData(NodeImpl node, String oldvalue, 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 class CoreDocumentImpl
    • 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 class CoreDocumentImpl
    • 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 class CoreDocumentImpl
    • 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 class CoreDocumentImpl
    • 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 class CoreDocumentImpl
    • 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 class CoreDocumentImpl
    • 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 class CoreDocumentImpl
    • 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 class CoreDocumentImpl
    • modifiedAttrValue

      void modifiedAttrValue(AttrImpl attr, 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 class CoreDocumentImpl
    • 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 class CoreDocumentImpl
    • removedAttrNode

      void removedAttrNode(AttrImpl attr, NodeImpl oldOwner, 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 class CoreDocumentImpl
    • renamedAttrNode

      void renamedAttrNode(Attr oldAt, 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 class CoreDocumentImpl
    • renamedElement

      void renamedElement(Element oldEl, 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 class CoreDocumentImpl