BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.apache.xerces.dom
Class DeferredDocumentImpl

java.lang.Object
  |
  +--weblogic.apache.xerces.dom.NodeImpl
        |
        +--weblogic.apache.xerces.dom.ChildNode
              |
              +--weblogic.apache.xerces.dom.ParentNode
                    |
                    +--weblogic.apache.xerces.dom.CoreDocumentImpl
                          |
                          +--weblogic.apache.xerces.dom.DocumentImpl
                                |
                                +--weblogic.apache.xerces.dom.DeferredDocumentImpl

public class DeferredDocumentImpl
extends DocumentImpl
implements DeferredNode

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.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

See Also:
Serialized Form

Field Summary
protected static int CHUNK_MASK
          Chunk mask.
protected static int CHUNK_SHIFT
          Chunk shift.
protected static int CHUNK_SIZE
          Chunk size.
protected  int fIdCount
          Identifier count.
protected  int[] fIdElement
          Identifier element indexes.
protected  java.lang.String[] fIdName
          Identifier name indexes.
protected  boolean fNamespacesEnabled
          DOM2: For namespace support in the deferred case.
protected  int fNodeCount
          Node count.
protected  int[][] fNodeExtra
          Extra data.
protected  int[][] fNodeLastChild
          Node first children.
protected  java.lang.Object[][] fNodeName
          Node names.
protected  int[][] fNodeParent
          Node parents.
protected  int[][] fNodePrevSib
          Node prev siblings.
protected  int[][] fNodeType
          Node types.
protected  java.lang.Object[][] fNodeURI
          Node namespace URI.
protected  java.lang.Object[][] fNodeValue
          Node values.
protected static int INITIAL_CHUNK_COUNT
          Initial chunk size.
 
Fields inherited from class weblogic.apache.xerces.dom.DocumentImpl
eventListeners, iterators, mutationEvents, ranges
 
Fields inherited from class weblogic.apache.xerces.dom.CoreDocumentImpl
actualEncoding, allowGrammarAccess, CDATA, changes, COMMENTS, DEFAULTS, docElement, docType, domNormalizer, DTNORMALIZATION, encoding, ENTITIES, errorChecking, fConfiguration, fDocumentURI, features, fEntityResolver, fErrorHandlerWrapper, fGrammar, fSymbolTable, identifiers, NAMESPACES, SPLITCDATA, standalone, userData, VALIDATION, 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
DeferredDocumentImpl()
          NON-DOM: Actually creating a Document is outside the DOM's spec, since it has to operate in terms of a particular implementation.
DeferredDocumentImpl(boolean namespacesEnabled)
          NON-DOM: Actually creating a Document is outside the DOM's spec, since it has to operate in terms of a particular implementation.
DeferredDocumentImpl(boolean namespaces, boolean grammarAccess)
          Experimental constructor.
 
Method Summary
 void appendChild(int parentIndex, int childIndex)
          Appends a child to the specified parent in the table.
protected static int binarySearch(int[] values, int start, int end, int target)
          Performs a binary search for a target value in an array of values.
 int cloneNode(int nodeIndex, boolean deep)
          Creates a clone of the specified node.
 int createDeferredAttribute(java.lang.String attrName, java.lang.String attrValue, boolean specified)
          Creates an attribute in the table.
 int createDeferredAttribute(java.lang.String attrName, java.lang.String attrURI, java.lang.String attrValue, boolean specified)
          Creates an attribute with a URI in the table.
 int createDeferredCDATASection(java.lang.String data)
          Creates a CDATA section node in the table.
 int createDeferredComment(java.lang.String data)
          Creates a comment node in the table.
 int createDeferredDocument()
          Creates a document node in the table.
 int createDeferredDocumentType(java.lang.String rootElementName, java.lang.String publicId, java.lang.String systemId)
          Creates a doctype.
 int createDeferredElement(java.lang.String elementName)
          Creates an element node in the table.
 int createDeferredElement(java.lang.String elementURI, java.lang.String elementName)
          Creates an element node with a URI in the table.
 int createDeferredElementDefinition(java.lang.String elementName)
          Creates an element definition in the table.
 int createDeferredEntity(java.lang.String entityName, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName, java.lang.String baseURI)
          Creates an entity in the table.
 int createDeferredEntityReference(java.lang.String name, java.lang.String baseURI)
          Creates an entity reference node in the table.
 int createDeferredNotation(java.lang.String notationName, java.lang.String publicId, java.lang.String systemId, java.lang.String baseURI)
          Creates a notation in the table.
 int createDeferredProcessingInstruction(java.lang.String target, java.lang.String data)
          Creates a processing instruction node in the table.
 int createDeferredTextNode(java.lang.String data, boolean ignorableWhitespace)
          Creates a text node in the table.
protected  int createNode(short nodeType)
          Creates a node of the specified type.
protected  void ensureCapacity(int chunk)
          Ensures that the internal tables are large enough.
 java.lang.String getAttribute(int elemIndex, java.lang.String name)
          Returns the attribute value of the given name.
 java.lang.String getDeferredEntityBaseURI(int entityIndex)
           
 int getLastChild(int nodeIndex)
          Returns the last child of the given node.
 int getLastChild(int nodeIndex, boolean free)
          Returns the last child of the given node.
 int getNodeExtra(int nodeIndex)
          Returns the extra info of the given node.
 int getNodeExtra(int nodeIndex, boolean free)
          Returns the extra info of the given node.
 int getNodeIndex()
          Returns the node index.
 java.lang.String getNodeName(int nodeIndex)
          Returns the name of the given node.
 java.lang.String getNodeName(int nodeIndex, boolean free)
          Returns the name of the given node.
 DeferredNode getNodeObject(int nodeIndex)
          Instantiates the requested node object.
 short getNodeType(int nodeIndex)
          Returns the type of the given node.
 short getNodeType(int nodeIndex, boolean free)
          Returns the type of the given node.
 java.lang.String getNodeURI(int nodeIndex)
          Returns the URI of the given node.
 java.lang.String getNodeURI(int nodeIndex, boolean free)
          Returns the URI of the given node.
 java.lang.String getNodeValue(int nodeIndex)
          Returns the value of the given node.
 java.lang.String getNodeValue(int nodeIndex, boolean free)
          Returns the value of the given node.
 java.lang.String getNodeValueString(int nodeIndex)
          Returns the real value of the given node.
 java.lang.String getNodeValueString(int nodeIndex, boolean free)
          Returns the real value of the given node.
 int getParentNode(int nodeIndex)
          Returns the parent node of the given node.
 int getParentNode(int nodeIndex, boolean free)
          Returns the parent node of the given node.
 int getPrevSibling(int nodeIndex)
          Returns the prev sibling of the given node.
 int getPrevSibling(int nodeIndex, boolean free)
          Returns the prev sibling of the given node.
 int getRealPrevSibling(int nodeIndex)
          Returns the real prev sibling of the given node, directly from the data structures.
 int getRealPrevSibling(int nodeIndex, boolean free)
          Returns the real prev sibling of the given node.
 int insertBefore(int parentIndex, int newChildIndex, int refChildIndex)
          Inserts a child before the specified node in the table.
 int lookupElementDefinition(java.lang.String elementName)
          Returns the index of the element definition in the table with the specified name index, or -1 if no such definition exists.
 void print()
          Prints out the tables.
 void putIdentifier(java.lang.String name, int elementNodeIndex)
          Registers an identifier name with a specified element node.
 void setActualEncoding(int currentEntityDecl, java.lang.String value)
           
 void setAsLastChild(int parentIndex, int childIndex)
          Sets the last child of the parentIndex to childIndex.
 int setAttributeNode(int elemIndex, int attrIndex)
          Adds an attribute node to the specified element.
 int setDeferredAttribute(int elementNodeIndex, java.lang.String attrName, java.lang.String attrURI, java.lang.String attrValue, boolean specified)
          Sets an attribute on an element node.
 int setDeferredPIBaseURI(int nodeIndex, java.lang.String baseURI)
          Set a baseURI for a processing instruction node in the table.
 void setEntityInfo(int currentEntityDecl, java.lang.String version, java.lang.String encoding)
           
 void setIdAttribute(int attrIndex)
          Sets type of attribute
 void setIdAttributeNode(int elemIndex, int attrIndex)
          Adds an attribute node to the specified element.
 void setInternalSubset(int doctypeIndex, java.lang.String subset)
           
protected  void synchronizeChildren()
          Synchronizes the node's children with the internal structure.
protected  void synchronizeChildren(AttrImpl a, int nodeIndex)
          Synchronizes the node's children with the internal structure.
protected  void synchronizeChildren(ParentNode p, int nodeIndex)
          Synchronizes the node's children with the internal structure.
protected  void synchronizeData()
          Synchronizes the node's data.
 
Methods inherited from class weblogic.apache.xerces.dom.DocumentImpl
addEventListener, cloneNode, copyEventListeners, createEvent, createNodeIterator, createNodeIterator, createRange, createTreeWalker, createTreeWalker, dispatchAggregateEvents, dispatchAggregateEvents, dispatchEvent, dispatchEventToSubtree, getEventListeners, getImplementation, removeEventListener, saveEnclosingAttr, setEventListeners
 
Methods inherited from class weblogic.apache.xerces.dom.CoreDocumentImpl
abort, adoptNode, canSetNormalizationFeature, changed, changes, clone, cloneNode, copyConfigurationProperties, createAttribute, createAttributeNS, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createDocumentType, createElement, createElementDefinition, createElementNS, createElementNS, createEntity, createEntityReference, createNotation, createProcessingInstruction, createTextNode, finalize, getActualEncoding, getAsync, getBaseURI, getDoctype, getDocumentElement, getDocumentURI, getElementById, getElementsByTagName, getElementsByTagNameNS, getEncoding, getErrorChecking, getErrorHandler, getIdentifier, getIdentifiers, getNodeName, getNodeType, getNormalizationFeature, getOwnerDocument, getStandalone, getStrictErrorChecking, getTextContent, getUserData, getUserData, getVersion, importNode, insertBefore, isKidOK, isNormalizeDocRequired, isXMLName, load, loadXML, normalizeDocument, putIdentifier, removeChild, removeIdentifier, renameNode, replaceChild, saveXML, setActualEncoding, setAsync, setDocumentURI, setEncoding, setErrorChecking, setErrorHandler, setNormalizationFeature, setStandalone, setStrictErrorChecking, setTextContent, setUserData, setUserData, setVersion
 
Methods inherited from class weblogic.apache.xerces.dom.ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, hasChildNodes, isEqualNode, item, normalize, setReadOnly
 
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, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHUNK_SHIFT

protected static final int CHUNK_SHIFT
Chunk shift.

CHUNK_SIZE

protected static final int CHUNK_SIZE
Chunk size.

CHUNK_MASK

protected static final int CHUNK_MASK
Chunk mask.

INITIAL_CHUNK_COUNT

protected static final int INITIAL_CHUNK_COUNT
Initial chunk size.

fNodeCount

protected transient int fNodeCount
Node count.

fNodeType

protected transient int[][] fNodeType
Node types.

fNodeName

protected transient java.lang.Object[][] fNodeName
Node names.

fNodeValue

protected transient java.lang.Object[][] fNodeValue
Node values.

fNodeParent

protected transient int[][] fNodeParent
Node parents.

fNodeLastChild

protected transient int[][] fNodeLastChild
Node first children.

fNodePrevSib

protected transient int[][] fNodePrevSib
Node prev siblings.

fNodeURI

protected transient java.lang.Object[][] fNodeURI
Node namespace URI.

fNodeExtra

protected transient int[][] fNodeExtra
Extra data.

fIdCount

protected transient int fIdCount
Identifier count.

fIdName

protected transient java.lang.String[] fIdName
Identifier name indexes.

fIdElement

protected transient int[] fIdElement
Identifier element indexes.

fNamespacesEnabled

protected boolean fNamespacesEnabled
DOM2: For namespace support in the deferred case.
Constructor Detail

DeferredDocumentImpl

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

DeferredDocumentImpl

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

DeferredDocumentImpl

public DeferredDocumentImpl(boolean namespaces,
                            boolean grammarAccess)
Experimental constructor.
Method Detail

createDeferredDocument

public int createDeferredDocument()
Creates a document node in the table.


createDeferredDocumentType

public int createDeferredDocumentType(java.lang.String rootElementName,
                                      java.lang.String publicId,
                                      java.lang.String systemId)
Creates a doctype.


setInternalSubset

public void setInternalSubset(int doctypeIndex,
                              java.lang.String subset)


createDeferredNotation

public int createDeferredNotation(java.lang.String notationName,
                                  java.lang.String publicId,
                                  java.lang.String systemId,
                                  java.lang.String baseURI)
Creates a notation in the table.


createDeferredEntity

public int createDeferredEntity(java.lang.String entityName,
                                java.lang.String publicId,
                                java.lang.String systemId,
                                java.lang.String notationName,
                                java.lang.String baseURI)
Creates an entity in the table.


getDeferredEntityBaseURI

public java.lang.String getDeferredEntityBaseURI(int entityIndex)


setEntityInfo

public void setEntityInfo(int currentEntityDecl,
                          java.lang.String version,
                          java.lang.String encoding)


setActualEncoding

public void setActualEncoding(int currentEntityDecl,
                              java.lang.String value)


createDeferredEntityReference

public int createDeferredEntityReference(java.lang.String name,
                                         java.lang.String baseURI)
Creates an entity reference node in the table.


createDeferredElement

public int createDeferredElement(java.lang.String elementName)
Creates an element node in the table.


createDeferredElement

public int createDeferredElement(java.lang.String elementURI,
                                 java.lang.String elementName)
Creates an element node with a URI in the table.


setDeferredAttribute

public int setDeferredAttribute(int elementNodeIndex,
                                java.lang.String attrName,
                                java.lang.String attrURI,
                                java.lang.String attrValue,
                                boolean specified)
Sets an attribute on an element node.


createDeferredAttribute

public int createDeferredAttribute(java.lang.String attrName,
                                   java.lang.String attrValue,
                                   boolean specified)
Creates an attribute in the table.


createDeferredAttribute

public int createDeferredAttribute(java.lang.String attrName,
                                   java.lang.String attrURI,
                                   java.lang.String attrValue,
                                   boolean specified)
Creates an attribute with a URI in the table.


createDeferredElementDefinition

public int createDeferredElementDefinition(java.lang.String elementName)
Creates an element definition in the table.


createDeferredTextNode

public int createDeferredTextNode(java.lang.String data,
                                  boolean ignorableWhitespace)
Creates a text node in the table.


createDeferredCDATASection

public int createDeferredCDATASection(java.lang.String data)
Creates a CDATA section node in the table.


createDeferredProcessingInstruction

public int createDeferredProcessingInstruction(java.lang.String target,
                                               java.lang.String data)
Creates a processing instruction node in the table.


setDeferredPIBaseURI

public int setDeferredPIBaseURI(int nodeIndex,
                                java.lang.String baseURI)
Set a baseURI for a processing instruction node in the table.


createDeferredComment

public int createDeferredComment(java.lang.String data)
Creates a comment node in the table.


cloneNode

public int cloneNode(int nodeIndex,
                     boolean deep)
Creates a clone of the specified node.


appendChild

public void appendChild(int parentIndex,
                        int childIndex)
Appends a child to the specified parent in the table.


setAttributeNode

public int setAttributeNode(int elemIndex,
                            int attrIndex)
Adds an attribute node to the specified element.


setIdAttributeNode

public void setIdAttributeNode(int elemIndex,
                               int attrIndex)
Adds an attribute node to the specified element.


setIdAttribute

public void setIdAttribute(int attrIndex)
Sets type of attribute


insertBefore

public int insertBefore(int parentIndex,
                        int newChildIndex,
                        int refChildIndex)
Inserts a child before the specified node in the table.


setAsLastChild

public void setAsLastChild(int parentIndex,
                           int childIndex)
Sets the last child of the parentIndex to childIndex.


getParentNode

public int getParentNode(int nodeIndex)
Returns the parent node of the given node. Calling this method does not free the parent index.


getParentNode

public int getParentNode(int nodeIndex,
                         boolean free)
Returns the parent node of the given node.

Parameters:
free - True to free parent node.

getLastChild

public int getLastChild(int nodeIndex)
Returns the last child of the given node.


getLastChild

public int getLastChild(int nodeIndex,
                        boolean free)
Returns the last child of the given node.

Parameters:
free - True to free child index.

getPrevSibling

public int getPrevSibling(int nodeIndex)
Returns the prev sibling of the given node. This is post-normalization of Text Nodes.


getPrevSibling

public int getPrevSibling(int nodeIndex,
                          boolean free)
Returns the prev sibling of the given node.

Parameters:
free - True to free sibling index.

getRealPrevSibling

public int getRealPrevSibling(int nodeIndex)
Returns the real prev sibling of the given node, directly from the data structures. Used by TextImpl#getNodeValue() to normalize values.


getRealPrevSibling

public int getRealPrevSibling(int nodeIndex,
                              boolean free)
Returns the real prev sibling of the given node.

Parameters:
free - True to free sibling index.

lookupElementDefinition

public int lookupElementDefinition(java.lang.String elementName)
Returns the index of the element definition in the table with the specified name index, or -1 if no such definition exists.


getNodeObject

public DeferredNode getNodeObject(int nodeIndex)
Instantiates the requested node object.


getNodeName

public java.lang.String getNodeName(int nodeIndex)
Returns the name of the given node.


getNodeName

public java.lang.String getNodeName(int nodeIndex,
                                    boolean free)
Returns the name of the given node.

Parameters:
free - True to free the string index.

getNodeValueString

public java.lang.String getNodeValueString(int nodeIndex)
Returns the real value of the given node.


getNodeValueString

public java.lang.String getNodeValueString(int nodeIndex,
                                           boolean free)
Returns the real value of the given node.

Parameters:
free - True to free the string index.

getNodeValue

public java.lang.String getNodeValue(int nodeIndex)
Returns the value of the given node.


getNodeValue

public java.lang.String getNodeValue(int nodeIndex,
                                     boolean free)
Returns the value of the given node.

Parameters:
free - True to free the value index.

getNodeExtra

public int getNodeExtra(int nodeIndex)
Returns the extra info of the given node. Used by AttrImpl to store specified value (1 == true).


getNodeExtra

public int getNodeExtra(int nodeIndex,
                        boolean free)
Returns the extra info of the given node.

Parameters:
free - True to free the value index.

getNodeType

public short getNodeType(int nodeIndex)
Returns the type of the given node.


getNodeType

public short getNodeType(int nodeIndex,
                         boolean free)
Returns the type of the given node.

Parameters:
free - True to free type index.

getAttribute

public java.lang.String getAttribute(int elemIndex,
                                     java.lang.String name)
Returns the attribute value of the given name.


getNodeURI

public java.lang.String getNodeURI(int nodeIndex)
Returns the URI of the given node.


getNodeURI

public java.lang.String getNodeURI(int nodeIndex,
                                   boolean free)
Returns the URI of the given node.

Parameters:
free - True to free URI index.

putIdentifier

public void putIdentifier(java.lang.String name,
                          int elementNodeIndex)
Registers an identifier name with a specified element node.


print

public void print()
Prints out the tables.


getNodeIndex

public int getNodeIndex()
Returns the node index.
Specified by:
getNodeIndex in interface DeferredNode


synchronizeData

protected void synchronizeData()
Synchronizes the node's data.

Overrides:
synchronizeData in class NodeImpl

synchronizeChildren

protected void synchronizeChildren()
Synchronizes the node's children with the internal structure. Fluffing the children at once solves a lot of work to keep the two structures in sync. The problem gets worse when editing the tree -- this makes it a lot easier.

Overrides:
synchronizeChildren in class ParentNode

synchronizeChildren

protected final void synchronizeChildren(AttrImpl a,
                                         int nodeIndex)
Synchronizes the node's children with the internal structure. Fluffing the children at once solves a lot of work to keep the two structures in sync. The problem gets worse when editing the tree -- this makes it a lot easier. This is not directly used in this class but this method is here so that it can be shared by all deferred subclasses of AttrImpl.


synchronizeChildren

protected final void synchronizeChildren(ParentNode p,
                                         int nodeIndex)
Synchronizes the node's children with the internal structure. Fluffing the children at once solves a lot of work to keep the two structures in sync. The problem gets worse when editing the tree -- this makes it a lot easier. This is not directly used in this class but this method is here so that it can be shared by all deferred subclasses of ParentNode.


ensureCapacity

protected void ensureCapacity(int chunk)
Ensures that the internal tables are large enough.


createNode

protected int createNode(short nodeType)
Creates a node of the specified type.


binarySearch

protected static int binarySearch(int[] values,
                                  int start,
                                  int end,
                                  int target)
Performs a binary search for a target value in an array of values. The array of values must be in ascending sorted order before calling this method and all array values must be non-negative.

Parameters:
values - The array of values to search.
start - The starting offset of the search.
end - The ending offset of the search.
target - The target value.
Returns:
This function will return the first occurrence of the target value, or -1 if the target value cannot be found.

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