BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.apache.xerces.dom
Class CoreDocumentImpl

java.lang.Object
  |
  +--weblogic.apache.xerces.dom.NodeImpl
        |
        +--weblogic.apache.xerces.dom.ChildNode
              |
              +--weblogic.apache.xerces.dom.ParentNode
                    |
                    +--weblogic.apache.xerces.dom.CoreDocumentImpl
Direct Known Subclasses:
DocumentImpl

public class CoreDocumentImpl
extends ParentNode
implements org.w3c.dom.Document, org.w3c.dom.ls.DocumentLS

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.

See Also:
Serialized Form

Field Summary
protected  java.lang.String actualEncoding
          Experimental DOM Level 3 feature: Document actualEncoding
protected  boolean allowGrammarAccess
          Allow grammar access.
protected static short CDATA
           
protected  int changes
          Number of alterations made to this document since its creation.
protected static short COMMENTS
           
protected static short DEFAULTS
           
protected  ElementImpl docElement
          Document element.
protected  DocumentTypeImpl docType
          Document type.
protected  DOMNormalizer domNormalizer
           
protected static short DTNORMALIZATION
           
protected  java.lang.String encoding
          Experimental DOM Level 3 feature: Document encoding
protected static short ENTITIES
           
protected  boolean errorChecking
          Bypass error checking.
protected  DOMValidationConfiguration fConfiguration
           
protected  java.lang.String fDocumentURI
          Experimental DOM Level 3 feature: documentURI
protected  short features
          Normalization features
protected  XMLEntityResolver fEntityResolver
           
protected  DOMErrorHandlerWrapper fErrorHandlerWrapper
          Experimental DOM Level 3 feature: errorHandler
protected  Grammar fGrammar
           
protected  ShadowedSymbolTable fSymbolTable
           
protected  java.util.Hashtable identifiers
          Identifiers.
protected static short NAMESPACES
           
protected static short SPLITCDATA
           
protected  boolean standalone
          Experimental DOM Level 3 feature: Document standalone
protected  java.util.Hashtable userData
          Table for user data attached to this document nodes.
protected static short VALIDATION
           
protected  java.lang.String version
          Experimental DOM Level 3 feature: Document version
 
Fields inherited from class weblogic.apache.xerces.dom.ParentNode
firstChild, fNodeListCache, ownerDocument
 
Fields inherited from class weblogic.apache.xerces.dom.ChildNode
nextSibling, previousSibling
 
Fields inherited from class weblogic.apache.xerces.dom.NodeImpl
ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, IDATTRIBUTE, IGNORABLEWS, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE, UNNORMALIZED
 
Constructor Summary
CoreDocumentImpl()
          NON-DOM: Actually creating a Document is outside the DOM's spec, since it has to operate in terms of a particular implementation.
CoreDocumentImpl(boolean grammarAccess)
          Constructor.
CoreDocumentImpl(org.w3c.dom.DocumentType doctype)
          For DOM2 support.
CoreDocumentImpl(org.w3c.dom.DocumentType doctype, boolean grammarAccess)
          For DOM2 support.
 
Method Summary
 void abort()
          DOM Level 3 WD - Experimental.
protected  void addEventListener(NodeImpl node, java.lang.String type, org.w3c.dom.events.EventListener listener, boolean useCapture)
           
 org.w3c.dom.Node adoptNode(org.w3c.dom.Node source)
          DOM Level 3 WD - Experimental Change the node's ownerDocument, and its subtree, to this Document
 boolean canSetNormalizationFeature(java.lang.String name, boolean state)
          DOM Level 3 WD - Experimental.
protected  void changed()
          Denotes that this node has changed.
protected  int changes()
          Returns the number of changes to this node.
 java.lang.Object clone()
          Clone.
 org.w3c.dom.Node cloneNode(boolean deep)
          Deep-clone a document, including fixing ownerDoc for the cloned children.
protected  void cloneNode(CoreDocumentImpl newdoc, boolean deep)
          internal method to share code with subclass
 void copyConfigurationProperties(XMLParserConfiguration config)
          NON-DOM: copy configuration properties from the parsing configuration.
protected  void copyEventListeners(NodeImpl src, NodeImpl tgt)
           
 org.w3c.dom.Attr createAttribute(java.lang.String name)
          Factory method; creates an Attribute having this Document as its OwnerDoc.
 org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Introduced in DOM Level 2.
 org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String localName)
          Xerces-specific constructor.
 org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
          Factory method; creates a CDATASection having this Document as its OwnerDoc.
 org.w3c.dom.Comment createComment(java.lang.String data)
          Factory method; creates a Comment having this Document as its OwnerDoc.
 org.w3c.dom.DocumentFragment createDocumentFragment()
          Factory method; creates a DocumentFragment having this Document as its OwnerDoc.
 org.w3c.dom.DocumentType createDocumentType(java.lang.String qualifiedName, java.lang.String publicID, java.lang.String systemID)
          NON-DOM Factory method; creates a DocumentType having this Document as its OwnerDoc.
 org.w3c.dom.Element createElement(java.lang.String tagName)
          Factory method; creates an Element having this Document as its OwnerDoc.
 ElementDefinitionImpl createElementDefinition(java.lang.String name)
          NON-DOM Factory method: creates an element definition.
 org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Introduced in DOM Level 2.
 org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String localpart)
          NON-DOM: Xerces-specific constructor.
 org.w3c.dom.Entity createEntity(java.lang.String name)
          NON-DOM Factory method; creates an Entity having this Document as its OwnerDoc.
 org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
          Factory method; creates an EntityReference having this Document as its OwnerDoc.
 org.w3c.dom.Notation createNotation(java.lang.String name)
          NON-DOM Factory method; creates a Notation having this Document as its OwnerDoc.
 org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
          Factory method; creates a ProcessingInstruction having this Document as its OwnerDoc.
 org.w3c.dom.Text createTextNode(java.lang.String data)
          Factory method; creates a Text node having this Document as its OwnerDoc.
protected  boolean dispatchEvent(NodeImpl node, org.w3c.dom.events.Event event)
           
 void finalize()
          Call user data handlers to let them know the nodes they are related to are being deleted.
 java.lang.String getActualEncoding()
          DOM Level 3 WD - Experimental.
 boolean getAsync()
          DOM Level 3 WD - Experimental.
 java.lang.String getBaseURI()
          DOM Level 3 WD - Experimental.
 org.w3c.dom.DocumentType getDoctype()
          For XML, this provides access to the Document Type Definition.
 org.w3c.dom.Element getDocumentElement()
          Convenience method, allowing direct access to the child node which is considered the root of the actual document content.
 java.lang.String getDocumentURI()
          DOM Level 3 WD - Experimental.
 org.w3c.dom.Element getElementById(java.lang.String elementId)
          Introduced in DOM Level 2 Returns the Element whose ID is given by elementId.
 org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
          Return a live collection of all descendent Elements (not just immediate children) having the specified tag name.
 org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
          Introduced in DOM Level 2.
 java.lang.String getEncoding()
          DOM Level 3 WD - Experimental.
 boolean getErrorChecking()
          Returns true if the DOM implementation performs error checking.
 org.apache.xerces.dom3.DOMErrorHandler getErrorHandler()
          DOM Level 3 WD - Experimental.
 org.w3c.dom.Element getIdentifier(java.lang.String idName)
          Returns a previously registered element with the specified identifier name, or null if no element is registered.
 java.util.Enumeration getIdentifiers()
          Returns an enumeration registered of identifier names.
 org.w3c.dom.DOMImplementation getImplementation()
          Retrieve information describing the abilities of this particular DOM implementation.
 java.lang.String getNodeName()
          Returns the node name.
 short getNodeType()
          Returns the node type.
 boolean getNormalizationFeature(java.lang.String name)
          DOM Level 3 WD - Experimental.
 org.w3c.dom.Document getOwnerDocument()
           
 boolean getStandalone()
          DOM Level 3 WD - Experimental.
 boolean getStrictErrorChecking()
           
 java.lang.String getTextContent()
           
protected  java.lang.Object getUserData(NodeImpl n)
          NON-DOM: kept for backward compatibility Retreive user data related to a given node
 java.lang.Object getUserData(org.w3c.dom.Node n, java.lang.String key)
          Retrieves the object associated to a key on a this node.
 java.lang.String getVersion()
          DOM Level 3 WD - Experimental.
 org.w3c.dom.Node importNode(org.w3c.dom.Node source, boolean deep)
          Copies a node from another document to this document.
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
          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.
protected  boolean isKidOK(org.w3c.dom.Node parent, org.w3c.dom.Node child)
          Uses the kidOK lookup table to check whether the proposed tree structure is legal.
protected  boolean isNormalizeDocRequired()
           
static boolean isXMLName(java.lang.String s)
          Check the string against XML's definition of acceptable names for elements and attributes and so on using the XMLCharacterProperties utility class
 boolean load(java.lang.String uri)
          DOM Level 3 WD - Experimental.
 boolean loadXML(java.lang.String source)
          DOM Level 3 WD - Experimental.
 void normalizeDocument()
          DOM Level 3 WD - Experimental Normalize document.
 void putIdentifier(java.lang.String idName, org.w3c.dom.Element element)
          Registers an identifier name with a specified element node.
 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
          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, java.lang.String type, org.w3c.dom.events.EventListener listener, boolean useCapture)
           
 void removeIdentifier(java.lang.String idName)
          Removes a previously registered element with the specified identifier name.
 org.w3c.dom.Node renameNode(org.w3c.dom.Node n, java.lang.String namespaceURI, java.lang.String name)
          DOM Level 3 WD - Experimental.
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
          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
 java.lang.String saveXML(org.w3c.dom.Node snode)
          DOM Level 3 WD - Experimental.
 void setActualEncoding(java.lang.String value)
          DOM Level 3 WD - Experimental.
 void setAsync(boolean async)
          DOM Level 3 WD - Experimental.
 void setDocumentURI(java.lang.String documentURI)
          DOM Level 3 WD - Experimental.
 void setEncoding(java.lang.String value)
          DOM Level 3 WD - Experimental.
 void setErrorChecking(boolean check)
          Sets whether the DOM implementation performs error checking upon operations.
 void setErrorHandler(org.apache.xerces.dom3.DOMErrorHandler errorHandler)
          DOM Level 3 WD - Experimental.
 void setNormalizationFeature(java.lang.String name, boolean state)
          DOM Level 3 WD - Experimental.
 void setStandalone(boolean value)
          DOM Level 3 WD - Experimental.
 void setStrictErrorChecking(boolean check)
           
 void setTextContent(java.lang.String textContent)
           
protected  void setUserData(NodeImpl n, java.lang.Object data)
          NON-DOM: kept for backward compatibility Store user data related to a given node This is a place where we could use weak references! Indeed, the node here won't be GC'ed as long as some user data is attached to it, since the userData table will have a reference to the node.
 java.lang.Object setUserData(org.w3c.dom.Node n, java.lang.String key, java.lang.Object data, org.apache.xerces.dom3.UserDataHandler handler)
          Associate an object to a key on this node.
 void setVersion(java.lang.String value)
          DOM Level 3 WD - Experimental.
 
Methods inherited from class weblogic.apache.xerces.dom.ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, hasChildNodes, isEqualNode, item, normalize, setReadOnly, synchronizeChildren
 
Methods inherited from class weblogic.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling
 
Methods inherited from class weblogic.apache.xerces.dom.NodeImpl
addEventListener, appendChild, compareTreePosition, dispatchEvent, getAttributes, getInterface, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getUserData, getUserData, hasAttributes, isDefaultNamespace, isSameNode, isSupported, lookupNamespacePrefix, lookupNamespaceURI, needsSyncChildren, removeEventListener, setNodeValue, setPrefix, setUserData, setUserData, synchronizeData, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

docType

protected DocumentTypeImpl docType
Document type.

docElement

protected ElementImpl docElement
Document element.

encoding

protected java.lang.String encoding
Experimental DOM Level 3 feature: Document encoding

actualEncoding

protected java.lang.String actualEncoding
Experimental DOM Level 3 feature: Document actualEncoding

version

protected java.lang.String version
Experimental DOM Level 3 feature: Document version

standalone

protected boolean standalone
Experimental DOM Level 3 feature: Document standalone

fDocumentURI

protected java.lang.String fDocumentURI
Experimental DOM Level 3 feature: documentURI

fErrorHandlerWrapper

protected final transient DOMErrorHandlerWrapper fErrorHandlerWrapper
Experimental DOM Level 3 feature: errorHandler

userData

protected java.util.Hashtable userData
Table for user data attached to this document nodes.

identifiers

protected java.util.Hashtable identifiers
Identifiers.

features

protected short features
Normalization features

NAMESPACES

protected static final short NAMESPACES

DTNORMALIZATION

protected static final short DTNORMALIZATION

ENTITIES

protected static final short ENTITIES

CDATA

protected static final short CDATA

DEFAULTS

protected static final short DEFAULTS

SPLITCDATA

protected static final short SPLITCDATA

COMMENTS

protected static final short COMMENTS

VALIDATION

protected static final short VALIDATION

domNormalizer

protected DOMNormalizer domNormalizer

fConfiguration

protected DOMValidationConfiguration fConfiguration

fSymbolTable

protected ShadowedSymbolTable fSymbolTable

fEntityResolver

protected XMLEntityResolver fEntityResolver

fGrammar

protected Grammar fGrammar

changes

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.


allowGrammarAccess

protected boolean allowGrammarAccess
Allow grammar access.

errorChecking

protected boolean errorChecking
Bypass error checking.
Constructor Detail

CoreDocumentImpl

public CoreDocumentImpl()
NON-DOM: Actually creating a Document is outside the DOM's spec, since it has to operate in terms of a particular implementation.

CoreDocumentImpl

public CoreDocumentImpl(boolean grammarAccess)
Constructor.

CoreDocumentImpl

public CoreDocumentImpl(org.w3c.dom.DocumentType doctype)
For DOM2 support. The createDocument factory method is in DOMImplementation.

CoreDocumentImpl

public CoreDocumentImpl(org.w3c.dom.DocumentType doctype,
                        boolean grammarAccess)
For DOM2 support.
Method Detail

getOwnerDocument

public final org.w3c.dom.Document getOwnerDocument()

Overrides:
getOwnerDocument in class ParentNode

getNodeType

public short getNodeType()
Returns the node type.

Overrides:
getNodeType in class NodeImpl

getNodeName

public java.lang.String getNodeName()
Returns the node name.

Overrides:
getNodeName in class NodeImpl

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.

Parameters:
deep - boolean, iff true replicate children
Returns:
org.w3c.dom.Node
Overrides:
cloneNode in class ParentNode

cloneNode

protected void cloneNode(CoreDocumentImpl newdoc,
                         boolean deep)
internal method to share code with subclass


insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.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

Overrides:
insertBefore in class ParentNode

removeChild

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                             throws org.w3c.dom.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

Overrides:
removeChild in class ParentNode

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws org.w3c.dom.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

Overrides:
replaceChild in class ParentNode

getTextContent

public java.lang.String getTextContent()
                                throws org.w3c.dom.DOMException

Overrides:
getTextContent in class ParentNode

setTextContent

public void setTextContent(java.lang.String textContent)
                    throws org.w3c.dom.DOMException

Overrides:
setTextContent in class ParentNode

createAttribute

public org.w3c.dom.Attr createAttribute(java.lang.String name)
                                 throws org.w3c.dom.DOMException
Factory method; creates an Attribute having this Document as its OwnerDoc.
Specified by:
createAttribute in interface org.w3c.dom.Document

Parameters:
name - The name of the attribute. Note that the attribute's value is _not_ established at the factory; remember to set it!
Throws:
DOMException(INVALID_NAME_ERR) - if the attribute name is not acceptable.

createCDATASection

public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
                                            throws org.w3c.dom.DOMException
Factory method; creates a CDATASection having this Document as its OwnerDoc.
Specified by:
createCDATASection in interface org.w3c.dom.Document

Parameters:
data - The initial contents of the CDATA
Throws:
DOMException(NOT_SUPPORTED_ERR) - for HTML documents. (HTML not yet implemented.)

createComment

public org.w3c.dom.Comment createComment(java.lang.String data)
Factory method; creates a Comment having this Document as its OwnerDoc.
Specified by:
createComment in interface org.w3c.dom.Document

Parameters:
data - The initial contents of the Comment.

createDocumentFragment

public org.w3c.dom.DocumentFragment createDocumentFragment()
Factory method; creates a DocumentFragment having this Document as its OwnerDoc.
Specified by:
createDocumentFragment in interface org.w3c.dom.Document


createElement

public org.w3c.dom.Element createElement(java.lang.String tagName)
                                  throws org.w3c.dom.DOMException
Factory method; creates an Element having this Document as its OwnerDoc.
Specified by:
createElement in interface org.w3c.dom.Document

Parameters:
tagName - The name of the element type to instantiate. For XML, this is case-sensitive. For HTML, the tagName parameter may be provided in any case, but it must be mapped to the canonical uppercase form by the DOM implementation.
Throws:
DOMException(INVALID_NAME_ERR) - if the tag name is not acceptable.

createEntityReference

public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
                                                  throws org.w3c.dom.DOMException
Factory method; creates an EntityReference having this Document as its OwnerDoc.
Specified by:
createEntityReference in interface org.w3c.dom.Document

Parameters:
name - The name of the Entity we wish to refer to
Throws:
DOMException(NOT_SUPPORTED_ERR) - for HTML documents, where nonstandard entities are not permitted. (HTML not yet implemented.)

createProcessingInstruction

public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                                     java.lang.String data)
                                                              throws org.w3c.dom.DOMException
Factory method; creates a ProcessingInstruction having this Document as its OwnerDoc.
Specified by:
createProcessingInstruction in interface org.w3c.dom.Document

Parameters:
target - The target "processor channel"
data - Parameter string to be passed to the target.
Throws:
DOMException(INVALID_NAME_ERR) - if the target name is not acceptable.
DOMException(NOT_SUPPORTED_ERR) - for HTML documents. (HTML not yet implemented.)

createTextNode

public org.w3c.dom.Text createTextNode(java.lang.String data)
Factory method; creates a Text node having this Document as its OwnerDoc.
Specified by:
createTextNode in interface org.w3c.dom.Document

Parameters:
data - The initial contents of the Text.

getDoctype

public org.w3c.dom.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.
Specified by:
getDoctype in interface org.w3c.dom.Document


getDocumentElement

public org.w3c.dom.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.)
Specified by:
getDocumentElement in interface org.w3c.dom.Document


getElementsByTagName

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
Return a live collection of all descendent Elements (not just immediate children) having the specified tag name.
Specified by:
getElementsByTagName in interface org.w3c.dom.Document

Parameters:
tagname - The type of Element we want to gather. "*" will be taken as a wildcard, meaning "all elements in the document."
See Also:
DeepNodeListImpl

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.
Specified by:
getImplementation in interface org.w3c.dom.Document


setErrorChecking

public void setErrorChecking(boolean check)
Sets whether the DOM implementation performs error checking upon operations. Turning off error checking only affects the following DOM checks:

Turning off error checking does not turn off the following checks:


setStrictErrorChecking

public void setStrictErrorChecking(boolean check)


getErrorChecking

public boolean getErrorChecking()
Returns true if the DOM implementation performs error checking.


getStrictErrorChecking

public boolean getStrictErrorChecking()


getActualEncoding

public java.lang.String getActualEncoding()
DOM Level 3 WD - Experimental. An attribute specifying the actual encoding of this document. This is null otherwise.
This attribute represents the property [character encoding scheme] defined in .


setActualEncoding

public void setActualEncoding(java.lang.String value)
DOM Level 3 WD - Experimental. An attribute specifying the actual encoding of this document. This is null otherwise.
This attribute represents the property [character encoding scheme] defined in .


setEncoding

public void setEncoding(java.lang.String value)
DOM Level 3 WD - Experimental. An attribute specifying, as part of the XML declaration, the encoding of this document. This is null when unspecified.


getEncoding

public java.lang.String getEncoding()
DOM Level 3 WD - Experimental. The encoding of this document (part of XML Declaration)


setVersion

public void setVersion(java.lang.String value)
DOM Level 3 WD - Experimental. version - An attribute specifying, as part of the XML declaration, the version number of this document. This is null when unspecified


getVersion

public java.lang.String getVersion()
DOM Level 3 WD - Experimental. The version of this document (part of XML Declaration)


setStandalone

public void setStandalone(boolean value)
DOM Level 3 WD - Experimental. standalone - An attribute specifying, as part of the XML declaration, whether this document is standalone


getStandalone

public boolean getStandalone()
DOM Level 3 WD - Experimental. standalone that specifies whether this document is standalone (part of XML Declaration)


getDocumentURI

public java.lang.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.


getErrorHandler

public org.apache.xerces.dom3.DOMErrorHandler getErrorHandler()
DOM Level 3 WD - Experimental. Retrieve error handler.


setErrorHandler

public void setErrorHandler(org.apache.xerces.dom3.DOMErrorHandler errorHandler)
DOM Level 3 WD - Experimental. Set error handler. It will be called in teh event that an error is encountered while performing an operation on a document.


renameNode

public org.w3c.dom.Node renameNode(org.w3c.dom.Node n,
                                   java.lang.String namespaceURI,
                                   java.lang.String name)
                            throws org.w3c.dom.DOMException
DOM Level 3 WD - Experimental. Renaming node


normalizeDocument

public void normalizeDocument()
DOM Level 3 WD - Experimental Normalize document.


isNormalizeDocRequired

protected boolean isNormalizeDocRequired()


setNormalizationFeature

public void setNormalizationFeature(java.lang.String name,
                                    boolean state)
                             throws org.w3c.dom.DOMException
DOM Level 3 WD - Experimental. setNormalizationFeature


getNormalizationFeature

public boolean getNormalizationFeature(java.lang.String name)
                                throws org.w3c.dom.DOMException
DOM Level 3 WD - Experimental. getNormalizationFeature


canSetNormalizationFeature

public boolean canSetNormalizationFeature(java.lang.String name,
                                          boolean state)
DOM Level 3 WD - Experimental. canSetNormalizationFeature


getBaseURI

public java.lang.String getBaseURI()
DOM Level 3 WD - Experimental. Retrieve baseURI

Overrides:
getBaseURI in class NodeImpl

setDocumentURI

public void setDocumentURI(java.lang.String documentURI)
DOM Level 3 WD - Experimental.


getAsync

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.
Specified by:
getAsync in interface org.w3c.dom.ls.DocumentLS


setAsync

public void setAsync(boolean async)
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.
Specified by:
setAsync in interface org.w3c.dom.ls.DocumentLS


abort

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.
Specified by:
abort in interface org.w3c.dom.ls.DocumentLS


load

public boolean load(java.lang.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 the document will fire a "load" event that the caller can register as a listener for. If an error occurs the document will fire an "error" event so that the caller knows that the load failed (see ParseErrorEvent).
Specified by:
load in interface org.w3c.dom.ls.DocumentLS

Parameters:
uri - The URI reference for the XML file to be loaded. If this is a relative URI...
Returns:
If async is set to true load returns true if the document load was successfully initiated. If an error occurred when initiating the document load load returns false.If async is set to false load returns true if the document was successfully loaded and parsed. If an error occurred when either loading or parsing the URI load returns false.

loadXML

public boolean loadXML(java.lang.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.
Specified by:
loadXML in interface org.w3c.dom.ls.DocumentLS

Parameters:
source - A string containing an XML document.
Returns:
true if parsing the input string succeeded without errors, otherwise false.

saveXML

public java.lang.String saveXML(org.w3c.dom.Node snode)
                         throws org.w3c.dom.DOMException
DOM Level 3 WD - Experimental. Save the document or the given node to a string (i.e. serialize the document or node).
Specified by:
saveXML in interface org.w3c.dom.ls.DocumentLS

Parameters:
snode - Specifies what to serialize, if this parameter is null the whole document is serialized, if it's non-null the given node is serialized.
Returns:
The serialized document or null.
Throws:
org.w3c.dom.DOMException - WRONG_DOCUMENT_ERR: Raised if the node passed in as the node parameter is from an other document.

createDocumentType

public org.w3c.dom.DocumentType createDocumentType(java.lang.String qualifiedName,
                                                   java.lang.String publicID,
                                                   java.lang.String systemID)
                                            throws org.w3c.dom.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.)

Parameters:
name - The name of the Entity we wish to provide a value for.
Throws:
DOMException(NOT_SUPPORTED_ERR) - for HTML documents, where DTDs are not permitted. (HTML not yet implemented.)

createEntity

public org.w3c.dom.Entity createEntity(java.lang.String name)
                                throws org.w3c.dom.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.)

Parameters:
name - The name of the Entity we wish to provide a value for.
Throws:
DOMException(NOT_SUPPORTED_ERR) - for HTML documents, where nonstandard entities are not permitted. (HTML not yet implemented.)

createNotation

public org.w3c.dom.Notation createNotation(java.lang.String name)
                                    throws org.w3c.dom.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.)

Parameters:
name - The name of the Notation we wish to describe
Throws:
DOMException(NOT_SUPPORTED_ERR) - for HTML documents, where notations are not permitted. (HTML not yet implemented.)

createElementDefinition

public ElementDefinitionImpl createElementDefinition(java.lang.String name)
                                              throws org.w3c.dom.DOMException
NON-DOM Factory method: creates an element definition. Element definitions hold default attribute values.


importNode

public org.w3c.dom.Node importNode(org.w3c.dom.Node source,
                                   boolean deep)
                            throws org.w3c.dom.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.

Specified by:
importNode in interface org.w3c.dom.Document


adoptNode

public org.w3c.dom.Node adoptNode(org.w3c.dom.Node source)
DOM Level 3 WD - Experimental Change the node's ownerDocument, and its subtree, to this Document

Parameters:
source - The node to adopt.
See Also:
importNode(org.w3c.dom.Node, boolean)

getElementById

public org.w3c.dom.Element getElementById(java.lang.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.

Specified by:
getElementById in interface org.w3c.dom.Document

See Also:
getIdentifier(java.lang.String)

putIdentifier

public void putIdentifier(java.lang.String idName,
                          org.w3c.dom.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.

See Also:
getIdentifier(java.lang.String), removeIdentifier(java.lang.String)

getIdentifier

public org.w3c.dom.Element getIdentifier(java.lang.String idName)
Returns a previously registered element with the specified identifier name, or null if no element is registered.

See Also:
putIdentifier(java.lang.String, org.w3c.dom.Element), removeIdentifier(java.lang.String)

removeIdentifier

public void removeIdentifier(java.lang.String idName)
Removes a previously registered element with the specified identifier name.

See Also:
putIdentifier(java.lang.String, org.w3c.dom.Element), getIdentifier(java.lang.String)

getIdentifiers

public java.util.Enumeration getIdentifiers()
Returns an enumeration registered of identifier names.


createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI,
                                           java.lang.String qualifiedName)
                                    throws org.w3c.dom.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].

Specified by:
createElementNS in interface org.w3c.dom.Document

Parameters:
namespaceURI - The namespace URI of the element to create.
qualifiedName - The qualified name of the element type to instantiate.
Returns:
Element A new Element object with the following attributes:
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.
org.w3c.dom.DOMException - NAMESPACE_ERR: Raised if the qualifiedName has a prefix that is "xml" and the namespaceURI is neither null nor an empty string nor "http://www.w3.org/XML/1998/namespace", or if the qualifiedName has a prefix different from "xml" and the namespaceURI is null or an empty string.

createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI,
                                           java.lang.String qualifiedName,
                                           java.lang.String localpart)
                                    throws org.w3c.dom.DOMException
NON-DOM: Xerces-specific constructor. "localName" is passed in, so we don't need to create a new String for it.

Parameters:
namespaceURI - The namespace URI of the element to create.
qualifiedName - The qualified name of the element type to instantiate.
localName - The local name of the element to instantiate.
Returns:
Element A new Element object with the following attributes:
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

createAttributeNS

public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
                                          java.lang.String qualifiedName)
                                   throws org.w3c.dom.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].

Specified by:
createAttributeNS in interface org.w3c.dom.Document

Parameters:
namespaceURI - The namespace URI of the attribute to create. When it is null or an empty string, this method behaves like createAttribute.
qualifiedName - The qualified name of the attribute to instantiate.
Returns:
Attr A new Attr object.
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

createAttributeNS

public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
                                          java.lang.String qualifiedName,
                                          java.lang.String localName)
                                   throws org.w3c.dom.DOMException
Xerces-specific constructor. "localName" is passed in, so we don't need to create a new String for it.

Parameters:
namespaceURI - The namespace URI of the attribute to create. When it is null or an empty string, this method behaves like createAttribute.
qualifiedName - The qualified name of the attribute to instantiate.
localName - The local name of the attribute to instantiate.
Returns:
Attr A new Attr object.
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

getElementsByTagNameNS

public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                                   java.lang.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.

Specified by:
getElementsByTagNameNS in interface org.w3c.dom.Document

Parameters:
namespaceURI - The namespace URI of the elements to match on. The special value "*" matches all namespaces. When it is null or an empty string, this method behaves like getElementsByTagName.
localName - The local name of the elements to match on. The special value "*" matches all local names.
Returns:
NodeList A new NodeList object containing all the matched Elements.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone.

Overrides:
clone in class java.lang.Object

isXMLName

public static boolean isXMLName(java.lang.String s)
Check the string against XML's definition of acceptable names for elements and attributes and so on using the XMLCharacterProperties utility class


isKidOK

protected boolean isKidOK(org.w3c.dom.Node parent,
                          org.w3c.dom.Node child)
Uses the kidOK lookup table to check whether the proposed tree structure is legal.


changed

protected void changed()
Denotes that this node has changed.

Overrides:
changed in class NodeImpl

changes

protected int changes()
Returns the number of changes to this node.

Overrides:
changes in class NodeImpl

setUserData

public java.lang.Object setUserData(org.w3c.dom.Node n,
                                    java.lang.String key,
                                    java.lang.Object data,
                                    org.apache.xerces.dom3.UserDataHandler handler)
Associate an object to a key on this node. The object can later be retrieved from this node by calling getUserData with the same key.

Parameters:
n - The node to associate the object to.
key - The key to associate the object to.
data - The object to associate to the given key, or null to remove any existing association to that key.
handler - The handler to associate to that key, or null.
Returns:
Returns the DOMObject previously associated to the given key on this node, or null if there was none.

getUserData

public java.lang.Object getUserData(org.w3c.dom.Node n,
                                    java.lang.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.

Parameters:
n - The node the object is associated to.
key - The key the object is associated to.
Returns:
Returns the DOMObject associated to the given key on this node, or null if there was none.

finalize

public void finalize()
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.

Overrides:
finalize in class java.lang.Object

copyConfigurationProperties

public void copyConfigurationProperties(XMLParserConfiguration config)
NON-DOM: copy configuration properties from the parsing configuration. This method is called after the parsing is done


setUserData

protected void setUserData(NodeImpl n,
                           java.lang.Object data)
NON-DOM: kept for backward compatibility Store user data related to a given node This is a place where we could use weak references! Indeed, the node here won't be GC'ed as long as some user data is attached to it, since the userData table will have a reference to the node.


getUserData

protected java.lang.Object getUserData(NodeImpl n)
NON-DOM: kept for backward compatibility Retreive user data related to a given node


addEventListener

protected void addEventListener(NodeImpl node,
                                java.lang.String type,
                                org.w3c.dom.events.EventListener listener,
                                boolean useCapture)


removeEventListener

protected void removeEventListener(NodeImpl node,
                                   java.lang.String type,
                                   org.w3c.dom.events.EventListener listener,
                                   boolean useCapture)


copyEventListeners

protected void copyEventListeners(NodeImpl src,
                                  NodeImpl tgt)


dispatchEvent

protected boolean dispatchEvent(NodeImpl node,
                                org.w3c.dom.events.Event event)


Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs81b