Overview | Package | Class | Tree | Deprecated | Index | Help
| Xerces 1.2.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xerces.dom
Class DeferredDocumentImpl

    java.lang.Object
      |
      +--org.apache.xerces.dom.NodeImpl
            |
            +--org.apache.xerces.dom.ParentNode
                  |
                  +--org.apache.xerces.dom.DocumentImpl
                        |
                        +--org.apache.xerces.dom.DeferredDocumentImpl

All Implemented Interfaces:
  java.lang.Cloneable, DeferredNode, Document, DocumentEvent, DocumentRange, DocumentTraversal, EventTarget, Node, NodeList, java.io.Serializable

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.

Since:
  PR-DOM-Level-1-19980818.
Version:
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 int[]` | `fIdName` Identifier name indexes.
`protected boolean` | `fNamespacesEnabled` DOM2: For namespace support in the deferred case.
`protected int` | `fNodeCount` Node count.
`protected int[][]` | `fNodeLastChild` Node first children.
`protected int[][]` | `fNodeName` Node names.
`protected int[][]` | `fNodeParent` Node parents.
`protected int[][]` | `fNodePrevSib` Node prev siblings.
`protected int[][]` | `fNodeType` Node types.
`protected int[][]` | `fNodeURI` Node namespace URI.
`protected int[][]` | `fNodeValue` Node values.
`protected org.apache.xerces.utils.StringPool` | `fStringPool` String pool cache.
`protected static int` | `INITIAL_CHUNK_COUNT` Initial chunk size.

Fields inherited from class org.apache.xerces.dom.DocumentImpl
`allowGrammarAccess, changes, docElement, docType, errorChecking, eventListeners, identifiers, iterators, kidOK, mutationEvents, ranges, userData`

Fields inherited from class org.apache.xerces.dom.ParentNode
`firstChild, nodeListIndex, nodeListLength, nodeListNode, ownerDocument`

Fields inherited from class org.apache.xerces.dom.NodeImpl
`ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, IGNORABLEWS, MUTATION_AGGREGATE, MUTATION_ALL, MUTATION_LOCAL, MUTATION_NONE, MUTATIONEVENTS, OWNED, ownerNode, READONLY, SETVALUE, SPECIFIED, SYNCCHILDREN, SYNCDATA`

Fields inherited from interface org.w3c.dom.Node
`ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE`

Constructor Summary
`DeferredDocumentImpl(org.apache.xerces.utils.StringPool stringPool)` NON-DOM: Actually creating a Document is outside the DOM's spec, since it has to operate in terms of a particular implementation.
`DeferredDocumentImpl(org.apache.xerces.utils.StringPool stringPool, 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(org.apache.xerces.utils.StringPool stringPool, 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` | `createAttribute(int attrNameIndex, int attrValueIndex, boolean specified)` Creates an attribute in the table.
`int` | `createAttribute(int attrNameIndex, int attrURIIndex, int attrValueIndex, boolean specified)` Creates an attribute with a URI in the table.
`int` | `createCDATASection(int dataIndex, boolean ignorableWhitespace)` Creates a CDATA section node in the table.
`int` | `createComment(int dataIndex)` Creates a comment node in the table.
`int` | `createDocument()` Creates a document node in the table.
`int` | `createDocumentType(int rootElementNameIndex, int publicId, int systemId)` Creates a doctype.
`int` | `createElement(int elementNameIndex, int elementURIIndex, XMLAttrList attrList, int attrListIndex)` Creates an element node with a URI in the table.
`int` | `createElement(int elementNameIndex, XMLAttrList attrList, int attrListIndex)` Creates an element node in the table.
`int` | `createElementDefinition(int elementNameIndex)` Creates an element definition in the table.
`int` | `createEntity(int entityName, int publicId, int systemId, int notationName)` Creates an entity in the table.
`int` | `createEntityReference(int nameIndex)` Creates an entity reference node in the table.
`protected int` | `createNode(short nodeType)` Creates a node of the specified type.
`int` | `createNotation(int notationName, int publicId, int systemId)` Creates a notation in the table.
`int` | `createProcessingInstruction(int targetIndex, int dataIndex)` Creates a processing instruction node in the table.
`int` | `createTextNode(int dataIndex, boolean ignorableWhitespace)` Creates a text node in the table.
`protected boolean` | `ensureCapacity(int chunk, int index)` Ensures that the internal tables are large enough.
`int` | `getAttribute(int elemIndex, int nameIndex)` Returns the attribute value of the given name.
`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` | `getNodeIndex()` Returns the node index.
`int` | `getNodeName(int nodeIndex)` Returns the real int name of the given node.
`int` | `getNodeName(int nodeIndex, boolean free)` Returns the real int name of the given node.
`java.lang.String` | `getNodeNameString(int nodeIndex)` Returns the name of the given node.
`java.lang.String` | `getNodeNameString(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.
`short` | `getNodeURI(int nodeIndex)` Returns the URI of the given node.
`short` | `getNodeURI(int nodeIndex, boolean free)` Returns the URI of the given node.
`int` | `getNodeValue(int nodeIndex)` Returns the real int value of the given node.
`int` | `getNodeValue(int nodeIndex, boolean free)` Returns the real int value of the given node.
`java.lang.String` | `getNodeValueString(int nodeIndex)` Returns the value of the given node.
`java.lang.String` | `getNodeValueString(int nodeIndex, boolean free)` Returns the 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.
`protected org.apache.xerces.utils.StringPool` | `getStringPool()` access to string pool.
`int` | `insertBefore(int parentIndex, int newChildIndex, int refChildIndex)` Inserts a child before the specified node in the table.
`int` | `lookupElementDefinition(int elementNameIndex)` 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(int nameIndex, int elementNodeIndex)` Registers an identifier name with a specified element node.
`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.
`void` | `setInternalSubset(int doctypeIndex, int subsetIndex)`
`protected void` | `synchronizeChildren()` Synchronizes the node's children with the internal structure.
`protected void` | `synchronizeData()` Synchronizes the node's data.

Methods inherited from class org.apache.xerces.dom.DocumentImpl
`adoptNode, changed, changes, clone, cloneNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createDocumentType, createElement, createElementDefinition, createElementNS, createEntity, createEntityReference, createEvent, createNodeIterator, createNodeIterator, createNotation, createProcessingInstruction, createRange, createTextNode, createTreeWalker, createTreeWalker, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getErrorChecking, getEventListeners, getIdentifier, getIdentifiers, getImplementation, getMutationEvents, getNodeName, getNodeType, getOwnerDocument, getUserData, importNode, insertBefore, isKidOK, isXMLName, putIdentifier, removeChild, removeIdentifier, replaceChild, setErrorChecking, setEventListeners, setMutationEvents, setUserData`

Methods inherited from class org.apache.xerces.dom.ParentNode
`getChildNodes, getFirstChild, getLastChild, getLength, hasChildNodes, item, normalize, setReadOnly, synchronizeChildren`

Methods inherited from class org.apache.xerces.dom.NodeImpl
`addEventListener, appendChild, dispatchEvent, getAttributes, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getParentNode, getPrefix, getPreviousSibling, getReadOnly, getUserData, hasAttributes, isSupported, removeEventListener, setNodeValue, setPrefix, setUserData, toString`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.w3c.dom.Node
`appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix`

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 int[][] fNodeName

  Node names.

### fNodeValue

    protected transient int[][] 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 int[][] fNodeURI

  Node namespace URI.

### fIdCount

    protected transient int fIdCount

  Identifier count.

### fIdName

    protected transient int[] fIdName

  Identifier name indexes.

### fIdElement

    protected transient int[] fIdElement

  Identifier element indexes.

### fStringPool

    protected transient org.apache.xerces.utils.StringPool fStringPool

  String pool cache.

### fNamespacesEnabled

    protected boolean fNamespacesEnabled

  DOM2: For namespace support in the deferred case.

Constructor Detail

### DeferredDocumentImpl

    public DeferredDocumentImpl(org.apache.xerces.utils.StringPool stringPool)

  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(org.apache.xerces.utils.StringPool stringPool,
                                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(org.apache.xerces.utils.StringPool stringPool,
                                boolean namespaces,
                                boolean grammarAccess)

  Experimental constructor.

Method Detail

### createDocument

    public int createDocument()

  Creates a document node in the table.

### createDocumentType

    public int createDocumentType(int rootElementNameIndex,
                                  int publicId,
                                  int systemId)

  Creates a doctype.

### setInternalSubset

    public void setInternalSubset(int doctypeIndex,
                                  int subsetIndex)

### createNotation

    public int createNotation(int notationName,
                              int publicId,
                              int systemId)
                       throws java.lang.Exception

  Creates a notation in the table.

### createEntity

    public int createEntity(int entityName,
                            int publicId,
                            int systemId,
                            int notationName)
                     throws java.lang.Exception

  Creates an entity in the table.

### createEntityReference

    public int createEntityReference(int nameIndex)
                              throws java.lang.Exception

  Creates an entity reference node in the table.

### createElement

    public int createElement(int elementNameIndex,
                             XMLAttrList attrList,
                             int attrListIndex)

  Creates an element node in the table.

### createElement

    public int createElement(int elementNameIndex,
                             int elementURIIndex,
                             XMLAttrList attrList,
                             int attrListIndex)

  Creates an element node with a URI in the table.

### createAttribute

    public int createAttribute(int attrNameIndex,
                               int attrValueIndex,
                               boolean specified)

  Creates an attribute in the table.

### createAttribute

    public int createAttribute(int attrNameIndex,
                               int attrURIIndex,
                               int attrValueIndex,
                               boolean specified)

  Creates an attribute with a URI in the table.

### createElementDefinition

    public int createElementDefinition(int elementNameIndex)

  Creates an element definition in the table.

### createTextNode

    public int createTextNode(int dataIndex,
                              boolean ignorableWhitespace)

  Creates a text node in the table.

### createCDATASection

    public int createCDATASection(int dataIndex,
                                  boolean ignorableWhitespace)

  Creates a CDATA section node in the table.

### createProcessingInstruction

    public int createProcessingInstruction(int targetIndex,
                                           int dataIndex)

  Creates a processing instruction node in the table.

### createComment

    public int createComment(int dataIndex)

  Creates a comment node in the table.

### 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.

### 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(int elementNameIndex)

  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.

### getNodeNameString

    public java.lang.String getNodeNameString(int nodeIndex)

  Returns the name of the given node.

### getNodeNameString

    public java.lang.String getNodeNameString(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 value of the given node.

### getNodeValueString

    public java.lang.String getNodeValueString(int nodeIndex,
                                               boolean free)

  Returns the value of the given node.
  Parameters:
    `free` - True to free the string index.

### getNodeName

    public int getNodeName(int nodeIndex)

  Returns the real int name of the given node.

### getNodeName

    public int getNodeName(int nodeIndex,
                           boolean free)

  Returns the real int name of the given node.
  Parameters:
    `free` - True to free the name index.

### getNodeValue

    public int getNodeValue(int nodeIndex)

  Returns the real int value of the given node. Used by AttrImpl to store specified value (1 == true).

### getNodeValue

    public int getNodeValue(int nodeIndex,
                            boolean free)

  Returns the real int value 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:
    `True` - to free type index.

### getAttribute

    public int getAttribute(int elemIndex,
                            int nameIndex)

  Returns the attribute value of the given name.

### getNodeURI

    public short getNodeURI(int nodeIndex)

  Returns the URI of the given node.

### getNodeURI

    public short getNodeURI(int nodeIndex,
                            boolean free)

  Returns the URI of the given node.
  Parameters:
    `True` - to free URI index.

### putIdentifier

    public void putIdentifier(int nameIndex,
                              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`

### getStringPool

    protected org.apache.xerces.utils.StringPool getStringPool()

  access to string pool.

### 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`

### ensureCapacity

    protected boolean ensureCapacity(int chunk,
                                     int index)

  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.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Xerces 1.2.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD