Save This Page
Home » Xerces-J-src.2.9.1 » org.apache.xerces » dom » [javadoc | source]
org.apache.xerces.dom
public class: CoreDocumentImpl [javadoc | source]
java.lang.Object
   org.apache.xerces.dom.NodeImpl
      org.apache.xerces.dom.ChildNode
         org.apache.xerces.dom.ParentNode
            org.apache.xerces.dom.CoreDocumentImpl

All Implemented Interfaces:
    Document, Cloneable, Node, EventTarget, Serializable, NodeList

Direct Known Subclasses:
    WMLDocumentImpl, PSVIDocumentImpl, DeferredDocumentImpl, DocumentImpl, 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.

The CoreDocumentImpl class only implements the DOM Core. Additional modules are supported by the more complete DocumentImpl subclass.

Note: When any node in the document is serialized, the entire document is serialized along with it.

Field Summary
static final  long serialVersionUID    Serialization version. 
protected  DocumentTypeImpl docType    Document type. 
protected  ElementImpl docElement    Document element. 
transient  NodeListCache fFreeNLCache    NodeListCache free list 
protected  String encoding    Experimental DOM Level 3 feature: Document encoding 
protected  String actualEncoding    Experimental DOM Level 3 feature: Document actualEncoding 
protected  String version    Experimental DOM Level 3 feature: Document version 
protected  boolean standalone    Experimental DOM Level 3 feature: Document standalone 
protected  String fDocumentURI    Experimental DOM Level 3 feature: documentURI 
protected  Hashtable userData    Table for user data attached to this document nodes. 
protected  Hashtable identifiers    Identifiers. 
transient  DOMNormalizer domNormalizer     
transient  DOMConfigurationImpl fConfiguration     
transient  Object fXPathEvaluator     
protected  int changes    Number of alterations made to this document since its creation. Serves as a "dirty bit" so that live objects such as NodeList can recognize when an alteration has been made and discard its cached state information.

Any method that alters the tree structure MUST cause or be accompanied by a call to changed(), to inform it that any outstanding NodeLists may have to be updated.

(Required because NodeList is simultaneously "live" and integer- indexed -- a bad decision in the DOM's design.)

Note that changes which do not affect the tree's structure -- changing the node's name, for example -- do _not_ have to call changed().

Alternative implementation would be to use a cryptographic Digest value rather than a count. This would have the advantage that "harmless" changes (those producing equal() trees) would not force NodeList to resynchronize. Disadvantage is that it's slightly more prone to "false negatives", though that's the difference between "wildly unlikely" and "absurdly unlikely". IF we start maintaining digests, we should consider taking advantage of them. Note: This used to be done a node basis, so that we knew what subtree changed. But since only DeepNodeList really use this today, the gain appears to be really small compared to the cost of having an int on every (parent) node plus having to walk up the tree all the way to the root to mark the branch as changed everytime a node is changed. So we now have a single counter global to the document. It means that some objects may flush their cache more often than necessary, but this makes nodes smaller and only the document needs to be marked as changed. 

protected  boolean allowGrammarAccess    Allow grammar access. 
protected  boolean errorChecking    Bypass error checking. 
protected  boolean xmlVersionChanged     
Fields inherited from org.apache.xerces.dom.ParentNode:
serialVersionUID,  ownerDocument,  firstChild,  fNodeListCache
Fields inherited from org.apache.xerces.dom.ChildNode:
serialVersionUID,  previousSibling,  nextSibling
Fields inherited from org.apache.xerces.dom.NodeImpl:
TREE_POSITION_PRECEDING,  TREE_POSITION_FOLLOWING,  TREE_POSITION_ANCESTOR,  TREE_POSITION_DESCENDANT,  TREE_POSITION_EQUIVALENT,  TREE_POSITION_SAME_NODE,  TREE_POSITION_DISCONNECTED,  DOCUMENT_POSITION_DISCONNECTED,  DOCUMENT_POSITION_PRECEDING,  DOCUMENT_POSITION_FOLLOWING,  DOCUMENT_POSITION_CONTAINS,  DOCUMENT_POSITION_IS_CONTAINED,  DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC,  serialVersionUID,  ELEMENT_DEFINITION_NODE,  ownerNode,  flags,  READONLY,  SYNCDATA,  SYNCCHILDREN,  OWNED,  FIRSTCHILD,  SPECIFIED,  IGNORABLEWS,  HASSTRING,  NORMALIZED,  ID
Constructor:
 public CoreDocumentImpl() 
 public CoreDocumentImpl(boolean grammarAccess) 
 public CoreDocumentImpl(DocumentType doctype) 
    For DOM2 support. The createDocument factory method is in DOMImplementation.
 public CoreDocumentImpl(DocumentType doctype,
    boolean grammarAccess) 
    For DOM2 support.
Method from org.apache.xerces.dom.CoreDocumentImpl Summary:
abort,   addEventListener,   adoptNode,   callUserDataHandlers,   callUserDataHandlers,   changed,   changes,   checkDOMNSErr,   checkNamespaceWF,   checkQName,   clearIdentifiers,   clone,   cloneNode,   cloneNode,   copyEventListeners,   createAttribute,   createAttributeNS,   createAttributeNS,   createCDATASection,   createComment,   createDocumentFragment,   createDocumentType,   createElement,   createElementDefinition,   createElementNS,   createElementNS,   createEntity,   createEntityReference,   createNotation,   createProcessingInstruction,   createTextNode,   deletedText,   dispatchEvent,   freeNodeListCache,   getAsync,   getBaseURI,   getDoctype,   getDocumentElement,   getDocumentURI,   getDomConfig,   getElementById,   getElementsByTagName,   getElementsByTagNameNS,   getEncoding,   getErrorChecking,   getFeature,   getIdentifier,   getIdentifiers,   getImplementation,   getInputEncoding,   getMutationEvents,   getNodeListCache,   getNodeName,   getNodeNumber,   getNodeNumber,   getNodeType,   getOwnerDocument,   getStandalone,   getStrictErrorChecking,   getTextContent,   getUserData,   getUserData,   getUserDataRecord,   getVersion,   getXmlEncoding,   getXmlStandalone,   getXmlVersion,   importNode,   insertBefore,   insertedNode,   insertedText,   insertingNode,   isKidOK,   isNormalizeDocRequired,   isValidQName,   isXML11Version,   isXMLName,   isXMLVersionChanged,   load,   loadXML,   modifiedAttrValue,   modifiedCharacterData,   modifyingCharacterData,   normalizeDocument,   putIdentifier,   removeChild,   removeEventListener,   removeIdentifier,   removeUserDataTable,   removedAttrNode,   removedNode,   removingNode,   renameNode,   renamedAttrNode,   renamedElement,   replaceChild,   replacedCharacterData,   replacedNode,   replacedText,   replacingData,   replacingNode,   saveXML,   setAsync,   setAttrNode,   setDocumentURI,   setEncoding,   setErrorChecking,   setInputEncoding,   setMutationEvents,   setStandalone,   setStrictErrorChecking,   setTextContent,   setUserData,   setUserData,   setUserDataTable,   setVersion,   setXmlEncoding,   setXmlStandalone,   setXmlVersion,   undeferChildren
Methods from org.apache.xerces.dom.ParentNode:
checkNormalizationAfterInsert,   checkNormalizationAfterRemove,   cloneNode,   getChildNodes,   getChildNodesUnoptimized,   getFirstChild,   getLastChild,   getLength,   getOwnerDocument,   getTextContent,   getTextContent,   hasChildNodes,   hasTextContent,   insertBefore,   internalInsertBefore,   internalRemoveChild,   isEqualNode,   item,   lastChild,   lastChild,   normalize,   ownerDocument,   removeChild,   replaceChild,   setOwnerDocument,   setReadOnly,   setTextContent,   synchronizeChildren
Methods from org.apache.xerces.dom.ChildNode:
cloneNode,   getNextSibling,   getParentNode,   getPreviousSibling,   parentNode,   previousSibling
Methods from org.apache.xerces.dom.NodeImpl:
addEventListener,   appendChild,   changed,   changes,   cloneNode,   compareDocumentPosition,   compareTreePosition,   dispatchEvent,   getAttributes,   getBaseURI,   getChildNodes,   getContainer,   getElementAncestor,   getFeature,   getFirstChild,   getLastChild,   getLength,   getLocalName,   getNamespaceURI,   getNextSibling,   getNodeName,   getNodeNumber,   getNodeType,   getNodeValue,   getOwnerDocument,   getParentNode,   getPrefix,   getPreviousSibling,   getReadOnly,   getTextContent,   getTextContent,   getUserData,   getUserData,   getUserDataRecord,   hasAttributes,   hasChildNodes,   hasStringValue,   hasStringValue,   insertBefore,   internalIsIgnorableWhitespace,   isDefaultNamespace,   isEqualNode,   isFirstChild,   isFirstChild,   isIdAttribute,   isIdAttribute,   isIgnorableWhitespace,   isNormalized,   isNormalized,   isOwned,   isOwned,   isReadOnly,   isReadOnly,   isSameNode,   isSpecified,   isSpecified,   isSupported,   item,   lookupNamespacePrefix,   lookupNamespaceURI,   lookupPrefix,   needsSyncChildren,   needsSyncChildren,   needsSyncData,   needsSyncData,   normalize,   ownerDocument,   parentNode,   previousSibling,   removeChild,   removeEventListener,   replaceChild,   setNodeValue,   setOwnerDocument,   setPrefix,   setReadOnly,   setTextContent,   setUserData,   setUserData,   synchronizeData,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.xerces.dom.CoreDocumentImpl Detail:
 public  void abort() 
    DOM Level 3 WD - Experimental. If the document is currently being loaded as a result of the method load being invoked the loading and parsing is immediately aborted. The possibly partial result of parsing the document is discarded and the document is cleared.
 protected  void addEventListener(NodeImpl node,
    String type,
    EventListener listener,
    boolean useCapture) 
 public Node adoptNode(Node source) 
    DOM Level 3 WD - Experimental Change the node's ownerDocument, and its subtree, to this Document
 protected  void callUserDataHandlers(Node n,
    Node c,
    short operation) 
    Call user data handlers when a node is deleted (finalized)
  void callUserDataHandlers(Node n,
    Node c,
    short operation,
    Hashtable userData) 
    Call user data handlers when a node is deleted (finalized)
 protected  void changed() 
    Denotes that this node has changed.
 protected int changes() 
    Returns the number of changes to this node.
 protected final  void checkDOMNSErr(String prefix,
    String namespace) 
 protected final  void checkNamespaceWF(String qname,
    int colon1,
    int colon2) 
    Call user data handlers to let them know the nodes they are related to are being deleted. The alternative would be to do that on Node but because the nodes are used as the keys we have a reference to them that prevents them from being gc'ed until the document is. At the same time, doing it here has the advantage of avoiding a finalize() method on Node, which would affect all nodes and not just the ones that have a user data.
 protected final  void checkQName(String prefix,
    String local) 
    Checks if the given qualified name is legal with respect to the version of XML to which this document must conform.
 protected final  void clearIdentifiers() 
    Remove all identifiers from the ID table
 public Object clone() throws CloneNotSupportedException 
    Clone.
 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.
 protected  void cloneNode(CoreDocumentImpl newdoc,
    boolean deep) 
    internal method to share code with subclass
 protected  void copyEventListeners(NodeImpl src,
    NodeImpl tgt) 
 public Attr createAttribute(String name) throws DOMException 
    Factory method; creates an Attribute having this Document as its OwnerDoc.
 public Attr createAttributeNS(String namespaceURI,
    String qualifiedName) throws DOMException 
    Introduced in DOM Level 2.

    Creates an attribute of the given qualified name and namespace URI. If the given namespaceURI is null or an empty string and the qualifiedName has a prefix that is "xml", the created element is bound to the predefined namespace "http://www.w3.org/XML/1998/namespace" [Namespaces].

 public Attr createAttributeNS(String namespaceURI,
    String qualifiedName,
    String localpart) throws DOMException 
    NON-DOM: a factory method used by the Xerces DOM parser to create an element.
 public CDATASection createCDATASection(String data) throws DOMException 
    Factory method; creates a CDATASection having this Document as its OwnerDoc.
 public Comment createComment(String data) 
    Factory method; creates a Comment having this Document as its OwnerDoc.
 public DocumentFragment createDocumentFragment() 
    Factory method; creates a DocumentFragment having this Document as its OwnerDoc.
 public DocumentType createDocumentType(String qualifiedName,
    String publicID,
    String systemID) throws DOMException 
    NON-DOM Factory method; creates a DocumentType having this Document as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD information unspecified.)
 public Element createElement(String tagName) throws DOMException 
    Factory method; creates an Element having this Document as its OwnerDoc.
 public ElementDefinitionImpl createElementDefinition(String name) throws DOMException 
    NON-DOM Factory method: creates an element definition. Element definitions hold default attribute values.
 public Element createElementNS(String namespaceURI,
    String qualifiedName) throws DOMException 
    Introduced in DOM Level 2.

    Creates an element of the given qualified name and namespace URI. If the given namespaceURI is null or an empty string and the qualifiedName has a prefix that is "xml", the created element is bound to the predefined namespace "http://www.w3.org/XML/1998/namespace" [Namespaces].

 public Element createElementNS(String namespaceURI,
    String qualifiedName,
    String localpart) throws DOMException 
    NON-DOM: a factory method used by the Xerces DOM parser to create an element.
 public Entity createEntity(String name) throws DOMException 
    NON-DOM Factory method; creates an Entity having this Document as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD information unspecified.)
 public EntityReference createEntityReference(String name) throws DOMException 
    Factory method; creates an EntityReference having this Document as its OwnerDoc.
 public Notation createNotation(String name) throws DOMException 
    NON-DOM Factory method; creates a Notation having this Document as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD information unspecified.)
 public ProcessingInstruction createProcessingInstruction(String target,
    String data) throws DOMException 
    Factory method; creates a ProcessingInstruction having this Document as its OwnerDoc.
 public Text createTextNode(String data) 
    Factory method; creates a Text node having this Document as its OwnerDoc.
  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.
 protected boolean dispatchEvent(NodeImpl node,
    Event event) 
  void freeNodeListCache(NodeListCache c) 
    Puts the given NodeListCache in the free list. Note: The owner node can keep using it until we reuse it
 public boolean getAsync() 
    DOM Level 3 WD - Experimental. Indicates whether the method load should be synchronous or asynchronous. When the async attribute is set to true the load method returns control to the caller before the document has completed loading. The default value of this property is false.
    Setting the value of this attribute might throw NOT_SUPPORTED_ERR if the implementation doesn't support the mode the attribute is being set to. Should the DOM spec define the default value of this property? What if implementing both async and sync IO is impractical in some systems? 2001-09-14. default is false but we need to check with Mozilla and IE.
 public String getBaseURI() 
    Returns the absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI. Note: If the URI is malformed, a null is returned.
 public DocumentType getDoctype() 
    For XML, this provides access to the Document Type Definition. For HTML documents, and XML documents which don't specify a DTD, it will be null.
 public Element getDocumentElement() 
    Convenience method, allowing direct access to the child node which is considered the root of the actual document content. For HTML, where it is legal to have more than one Element at the top level of the document, we pick the one with the tagName "HTML". For XML there should be only one top-level (HTML not yet supported.)
 public String getDocumentURI() 
    DOM Level 3 WD - Experimental. The location of the document or null if undefined.
    Beware that when the Document supports the feature "HTML" , the href attribute of the HTML BASE element takes precedence over this attribute.
 public DOMConfiguration getDomConfig() 
    DOM Level 3 CR - Experimental The configuration used when Document.normalizeDocument is invoked.
 public Element getElementById(String elementId) 
    Introduced in DOM Level 2 Returns the Element whose ID is given by elementId. If no such element exists, returns null. Behavior is not defined if more than one element has this ID.

    Note: The DOM implementation must have information that says which attributes are of type ID. Attributes with the name "ID" are not of type ID unless so defined. Implementations that do not know whether attributes are of type ID or not are expected to return null.

 public NodeList getElementsByTagName(String tagname) 
    Return a live collection of all descendent Elements (not just immediate children) having the specified tag name.
 public NodeList getElementsByTagNameNS(String namespaceURI,
    String localName) 
    Introduced in DOM Level 2.

    Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they would be encountered in a preorder traversal of the Document tree.

 public String getEncoding() 
Deprecated! This - method is internal and only exists for compatibility with older applications. New applications should never call this method.

 public boolean getErrorChecking() 
    Returns true if the DOM implementation performs error checking.
 public Object getFeature(String feature,
    String version) 
 public Element getIdentifier(String idName) 
    Returns a previously registered element with the specified identifier name, or null if no element is registered.
 public Enumeration getIdentifiers() 
    Returns an enumeration registered of identifier names.
 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.
 public String getInputEncoding() 
    DOM Level 3 CR - Experimental. (Was getActualEncoding) An attribute specifying the encoding used for this document at the time of the parsing. This is null when it is not known, such as when the Document was created in memory.
 boolean getMutationEvents() 
    Returns true if the DOM implementation generates mutation events.
 NodeListCache getNodeListCache(ParentNode owner) 
    Returns a NodeListCache for the given node.
 public String getNodeName() 
    Returns the node name.
 protected int getNodeNumber() 
    NON-DOM: Get the number associated with this document. Used to order documents in the implementation.
 protected int getNodeNumber(Node node) 
    NON-DOM: Get a number associated with a node created with respect to this document. Needed for compareDocumentPosition when nodes are disconnected. This is only used on demand.
 public short getNodeType() 
    Returns the node type.
 public final Document getOwnerDocument() 
 public boolean getStandalone() 
Deprecated! This - method is internal and only exists for compatibility with older applications. New applications should never call this method.

 public boolean getStrictErrorChecking() 
 public String getTextContent() throws DOMException 
 protected Object getUserData(NodeImpl n) 
    NON-DOM: kept for backward compatibility Retreive user data related to a given node
 public Object getUserData(Node n,
    String key) 
    Retrieves the object associated to a key on a this node. The object must first have been set to this node by calling setUserData with the same key.
 protected Hashtable getUserDataRecord(Node n) 
 public String getVersion() 
Deprecated! This - method is internal and only exists for compatibility with older applications. New applications should never call this method.

 public String getXmlEncoding() 
    DOM Level 3 WD - Experimental. The encoding of this document (part of XML Declaration)
 public boolean getXmlStandalone() 
    DOM Level 3 WD - Experimental. standalone that specifies whether this document is standalone (part of XML Declaration)
 public String getXmlVersion() 
    DOM Level 3 WD - Experimental. The version of this document (part of XML Declaration)
 public Node importNode(Node source,
    boolean deep) throws DOMException 
    Copies a node from another document to this document. The new nodes are created using this document's factory methods and are populated with the data from the source's accessor methods defined by the DOM interfaces. Its behavior is otherwise similar to that of cloneNode.

    According to the DOM specifications, document nodes cannot be imported and a NOT_SUPPORTED_ERR exception is thrown if attempted.

 public Node insertBefore(Node newChild,
    Node refChild) throws DOMException 
    Since a Document may contain at most one top-level Element child, and at most one DocumentType declaraction, we need to subclass our add-children methods to implement this constraint. Since appendChild() is implemented as insertBefore(,null), altering the latter fixes both.

    While I'm doing so, I've taken advantage of the opportunity to cache documentElement and docType so we don't have to search for them. REVISIT: According to the spec it is not allowed to alter neither the document element nor the document type in any way

  void insertedNode(NodeImpl node,
    NodeImpl newInternal,
    boolean replace) 
    A method to be called when a node has been inserted in the tree.
  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.
  void insertingNode(NodeImpl node,
    boolean replace) 
    A method to be called when a node is about to be inserted in the tree.
 protected boolean isKidOK(Node parent,
    Node child) 
    Uses the kidOK lookup table to check whether the proposed tree structure is legal.
 boolean isNormalizeDocRequired() 
 public static final boolean isValidQName(String prefix,
    String local,
    boolean xml11Version) 
    Checks if the given qualified name is legal with respect to the version of XML to which this document must conform.
 boolean isXML11Version() 
    We could have more xml versions in future , but for now we could do with this to handle XML 1.0 and 1.1
 public static final boolean isXMLName(String s,
    boolean xml11Version) 
    Check the string against XML's definition of acceptable names for elements and attributes and so on using the XMLCharacterProperties utility class
 boolean isXMLVersionChanged() 
 public boolean load(String uri) 
    DOM Level 3 WD - Experimental. Replaces the content of the document with the result of parsing the given URI. Invoking this method will either block the caller or return to the caller immediately depending on the value of the async attribute. Once the document is fully loaded a "load" event (as defined in [DOM Level 3 Events] , except that the Event.targetNode will be the document, not an element) will be dispatched on the document. If an error occurs, an implementation dependent "error" event will be dispatched on the document. If this method is called on a document that is currently loading, the current load is interrupted and the new URI load is initiated.
    When invoking this method the parameters used in the DOMParser interface are assumed to have their default values with the exception that the parameters "entities" , "normalize-characters", "check-character-normalization" are set to "false".
    The result of a call to this method is the same the result of a call to DOMParser.parseWithContext with an input stream referencing the URI that was passed to this call, the document as the context node, and the action ACTION_REPLACE_CHILDREN.
 public boolean loadXML(String source) 
    DOM Level 3 WD - Experimental. Replace the content of the document with the result of parsing the input string, this method is always synchronous.
  void modifiedAttrValue(AttrImpl attr,
    String oldvalue) 
    A method to be called when an attribute value has been modified
  void modifiedCharacterData(NodeImpl node,
    String oldvalue,
    String value,
    boolean replace) 
    A method to be called when a character data node has been modified
  void modifyingCharacterData(NodeImpl node,
    boolean replace) 
    A method to be called when a character data node is about to be modified
 public  void normalizeDocument() 
    DOM Level 3 WD - Experimental Normalize document.
 public  void putIdentifier(String idName,
    Element element) 
    Registers an identifier name with a specified element node. If the identifier is already registered, the new element node replaces the previous node. If the specified element node is null, removeIdentifier() is called.
 public Node removeChild(Node oldChild) throws DOMException 
    Since insertBefore caches the docElement (and, currently, docType), removeChild has to know how to undo the cache REVISIT: According to the spec it is not allowed to alter neither the document element nor the document type in any way
 protected  void removeEventListener(NodeImpl node,
    String type,
    EventListener listener,
    boolean useCapture) 
 public  void removeIdentifier(String idName) 
    Removes a previously registered element with the specified identifier name.
 Hashtable removeUserDataTable(Node n) 
    Remove user data table for the given node.
  void removedAttrNode(AttrImpl attr,
    NodeImpl oldOwner,
    String name) 
    A method to be called when an attribute node has been removed
  void removedNode(NodeImpl node,
    boolean replace) 
    A method to be called when a node has been removed from the tree.
  void removingNode(NodeImpl node,
    NodeImpl oldChild,
    boolean replace) 
    A method to be called when a node is about to be removed from the tree.
 public Node renameNode(Node n,
    String namespaceURI,
    String name) throws DOMException 
    DOM Level 3 WD - Experimental. Renaming node
  void renamedAttrNode(Attr oldAt,
    Attr newAt) 
    A method to be called when an attribute node has been renamed
  void renamedElement(Element oldEl,
    Element newEl) 
    A method to be called when an element has been renamed
 public Node replaceChild(Node newChild,
    Node oldChild) throws DOMException 
    Since we cache the docElement (and, currently, docType), replaceChild has to update the cache REVISIT: According to the spec it is not allowed to alter neither the document element nor the document type in any way
  void replacedCharacterData(NodeImpl node,
    String oldvalue,
    String value) 
    method to be called when a character data node has been replaced.
  void replacedNode(NodeImpl node) 
    A method to be called when a node has been replaced in the tree.
  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.
  void replacingData(NodeImpl node) 
    A method to be called when a character data node is about to be replaced
  void replacingNode(NodeImpl node) 
    A method to be called when a node is about to be replaced in the tree.
 public String saveXML(Node node) throws