public class

DeferredDocumentImpl

extends DocumentImpl
implements DeferredNode
java.lang.Object
   ↳ org.apache.xerces.dom.NodeImpl
     ↳ org.apache.xerces.dom.ChildNode
       ↳ org.apache.xerces.dom.ParentNode
         ↳ org.apache.xerces.dom.CoreDocumentImpl
           ↳ org.apache.xerces.dom.DocumentImpl
             ↳ org.apache.xerces.dom.DeferredDocumentImpl

Class Overview

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.@xerces.internal

Summary

Constants
int CHUNK_MASK Chunk mask.
int CHUNK_SHIFT Chunk shift.
int CHUNK_SIZE Chunk size.
int INITIAL_CHUNK_COUNT Initial chunk size.
[Expand]
Inherited Constants
From class org.apache.xerces.dom.NodeImpl
From interface org.apache.xerces.dom.DeferredNode
From interface org.w3c.dom.Node
Fields
protected int fIdCount Identifier count.
protected int[] fIdElement Identifier element indexes.
protected 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 Object[][] fNodeName Node names.
protected int[][] fNodeParent Node parents.
protected int[][] fNodePrevSib Node prev siblings.
protected int[][] fNodeType Node types.
protected Object[][] fNodeURI Node namespace URI.
protected Object[][] fNodeValue Node values.
[Expand]
Inherited Fields
From class org.apache.xerces.dom.DocumentImpl
From class org.apache.xerces.dom.CoreDocumentImpl
From class org.apache.xerces.dom.ParentNode
From class org.apache.xerces.dom.ChildNode
From class org.apache.xerces.dom.NodeImpl
Public Constructors
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.
Public Methods
void appendChild(int parentIndex, int childIndex)
Appends a child to the specified parent in the table.
int cloneNode(int nodeIndex, boolean deep)
Creates a clone of the specified node.
int createDeferredAttribute(String attrName, String attrValue, boolean specified)
Creates an attribute in the table.
int createDeferredAttribute(String attrName, String attrURI, String attrValue, boolean specified)
Creates an attribute with a URI in the table.
int createDeferredCDATASection(String data)
Creates a CDATA section node in the table.
int createDeferredComment(String data)
Creates a comment node in the table.
int createDeferredDocument()
Creates a document node in the table.
int createDeferredDocumentType(String rootElementName, String publicId, String systemId)
Creates a doctype.
int createDeferredElement(String elementName)
This method is deprecated. No replacement.
int createDeferredElement(String elementURI, String elementName)
This method is deprecated. No replacement.
int createDeferredElement(String elementURI, String elementName, Object type)
Creates an element node with a URI in the table and type information.
int createDeferredElementDefinition(String elementName)
Creates an element definition in the table.
int createDeferredEntity(String entityName, String publicId, String systemId, String notationName, String baseURI)
Creates an entity in the table.
int createDeferredEntityReference(String name, String baseURI)
Creates an entity reference node in the table.
int createDeferredNotation(String notationName, String publicId, String systemId, String baseURI)
Creates a notation in the table.
int createDeferredProcessingInstruction(String target, String data)
Creates a processing instruction node in the table.
int createDeferredTextNode(String data, boolean ignorableWhitespace)
Creates a text node in the table.
String getAttribute(int elemIndex, String name)
Returns the attribute value of the given name.
String getDeferredEntityBaseURI(int entityIndex)
DOMImplementation getImplementation()
Retrieve information describing the abilities of this particular DOM implementation.
int getLastChild(int nodeIndex, boolean free)
Returns the last child of the given node.
int getLastChild(int nodeIndex)
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.
String getNodeName(int nodeIndex, boolean free)
Returns the name of the given node.
String getNodeName(int nodeIndex)
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.
String getNodeURI(int nodeIndex)
Returns the URI of the given node.
String getNodeURI(int nodeIndex, boolean free)
Returns the URI of the given node.
String getNodeValue(int nodeIndex)
Returns the value of the given node.
String getNodeValue(int nodeIndex, boolean free)
Returns the value of the given node.
String getNodeValueString(int nodeIndex, boolean free)
Returns the real value of the given node.
String getNodeValueString(int nodeIndex)
Returns the real value of the given node.
int getParentNode(int nodeIndex, boolean free)
Returns the parent node of the given node.
int getParentNode(int nodeIndex)
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.
Object getTypeInfo(int nodeIndex)
Clears the type info that is stored in the fNodeValue array
int insertBefore(int parentIndex, int newChildIndex, int refChildIndex)
Inserts a child before the specified node in the table.
int lookupElementDefinition(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(String name, 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.
int setDeferredAttribute(int elementNodeIndex, String attrName, String attrURI, String attrValue, boolean specified)
This method is deprecated. No replacement.
int setDeferredAttribute(int elementNodeIndex, String attrName, String attrURI, String attrValue, boolean specified, boolean id, Object type)
This method is used by the DOMParser to create attributes.
void setEntityInfo(int currentEntityDecl, String version, 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 setInputEncoding(int currentEntityDecl, String value)
DOM Internal An attribute specifying the actual encoding of this document.
void setInternalSubset(int doctypeIndex, String subset)
Protected Methods
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 createNode(short nodeType)
Creates a node of the specified type.
void ensureCapacity(int chunk)
Ensures that the internal tables are large enough.
final void synchronizeChildren(AttrImpl a, int nodeIndex)
Synchronizes the node's children with the internal structure.
final void synchronizeChildren(ParentNode p, int nodeIndex)
Synchronizes the node's children with the internal structure.
void synchronizeChildren()
Synchronizes the node's children with the internal structure.
void synchronizeData()
Synchronizes the node's data.
[Expand]
Inherited Methods
From class org.apache.xerces.dom.DocumentImpl
From class org.apache.xerces.dom.CoreDocumentImpl
From class org.apache.xerces.dom.ParentNode
From class org.apache.xerces.dom.ChildNode
From class org.apache.xerces.dom.NodeImpl
From class java.lang.Object
From interface org.apache.xerces.dom.DeferredNode
From interface org.w3c.dom.Document
From interface org.w3c.dom.Node
From interface org.w3c.dom.NodeList
From interface org.w3c.dom.events.DocumentEvent
From interface org.w3c.dom.events.EventTarget
From interface org.w3c.dom.ranges.DocumentRange
From interface org.w3c.dom.traversal.DocumentTraversal

Constants

protected static final int CHUNK_MASK

Chunk mask.

Constant Value: 2047 (0x000007ff)

protected static final int CHUNK_SHIFT

Chunk shift.

Constant Value: 11 (0x0000000b)

protected static final int CHUNK_SIZE

Chunk size.

Constant Value: 2048 (0x00000800)

protected static final int INITIAL_CHUNK_COUNT

Initial chunk size.

Constant Value: 32 (0x00000020)

Fields

protected int fIdCount

Identifier count.

protected int[] fIdElement

Identifier element indexes.

protected 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 Object[][] fNodeName

Node names.

protected int[][] fNodeParent

Node parents.

protected int[][] fNodePrevSib

Node prev siblings.

protected int[][] fNodeType

Node types.

protected Object[][] fNodeURI

Node namespace URI.

protected Object[][] fNodeValue

Node values.

Public Constructors

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.

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.

public DeferredDocumentImpl (boolean namespaces, boolean grammarAccess)

Experimental constructor.

Public Methods

public void appendChild (int parentIndex, int childIndex)

Appends a child to the specified parent in the table.

public int cloneNode (int nodeIndex, boolean deep)

Creates a clone of the specified node.

public int createDeferredAttribute (String attrName, String attrValue, boolean specified)

Creates an attribute in the table.

public int createDeferredAttribute (String attrName, String attrURI, String attrValue, boolean specified)

Creates an attribute with a URI in the table.

public int createDeferredCDATASection (String data)

Creates a CDATA section node in the table.

public int createDeferredComment (String data)

Creates a comment node in the table.

public int createDeferredDocument ()

Creates a document node in the table.

public int createDeferredDocumentType (String rootElementName, String publicId, String systemId)

Creates a doctype.

public int createDeferredElement (String elementName)

This method is deprecated.
No replacement.

Creates an element node in the table.

public int createDeferredElement (String elementURI, String elementName)

This method is deprecated.
No replacement.

Creates an element node with a URI in the table.

public int createDeferredElement (String elementURI, String elementName, Object type)

Creates an element node with a URI in the table and type information.

public int createDeferredElementDefinition (String elementName)

Creates an element definition in the table.

public int createDeferredEntity (String entityName, String publicId, String systemId, String notationName, String baseURI)

Creates an entity in the table.

public int createDeferredEntityReference (String name, String baseURI)

Creates an entity reference node in the table.

public int createDeferredNotation (String notationName, String publicId, String systemId, String baseURI)

Creates a notation in the table.

public int createDeferredProcessingInstruction (String target, String data)

Creates a processing instruction node in the table.

public int createDeferredTextNode (String data, boolean ignorableWhitespace)

Creates a text node in the table.

public String getAttribute (int elemIndex, String name)

Returns the attribute value of the given name.

public String getDeferredEntityBaseURI (int entityIndex)

public DOMImplementation getImplementation ()

Retrieve information describing the abilities of this particular DOM implementation. Intended to support applications that may be using DOMs retrieved from several different sources, potentially with different underlying representations.

public int getLastChild (int nodeIndex, boolean free)

Returns the last child of the given node.

Parameters
free True to free child index.

public int getLastChild (int nodeIndex)

Returns the last child of the given node.

public int getNodeExtra (int nodeIndex)

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

public int getNodeExtra (int nodeIndex, boolean free)

Returns the extra info of the given node.

Parameters
free True to free the value index.

public int getNodeIndex ()

Returns the node index.

public String getNodeName (int nodeIndex, boolean free)

Returns the name of the given node.

Parameters
free True to free the string index.

public String getNodeName (int nodeIndex)

Returns the name of the given node.

public DeferredNode getNodeObject (int nodeIndex)

Instantiates the requested node object.

public short getNodeType (int nodeIndex)

Returns the type of the given node.

public short getNodeType (int nodeIndex, boolean free)

Returns the type of the given node.

Parameters
free True to free type index.

public String getNodeURI (int nodeIndex)

Returns the URI of the given node.

public String getNodeURI (int nodeIndex, boolean free)

Returns the URI of the given node.

Parameters
free True to free URI index.

public String getNodeValue (int nodeIndex)

Returns the value of the given node.

public String getNodeValue (int nodeIndex, boolean free)

Returns the value of the given node.

Parameters
free True to free the value index.

public String getNodeValueString (int nodeIndex, boolean free)

Returns the real value of the given node.

Parameters
free True to free the string index.

public String getNodeValueString (int nodeIndex)

Returns the real value of the given node.

public int getParentNode (int nodeIndex, boolean free)

Returns the parent node of the given node.

Parameters
free True to free parent node.

public int getParentNode (int nodeIndex)

Returns the parent node of the given node. Calling this method does not free the parent index.

public int getPrevSibling (int nodeIndex)

Returns the prev sibling of the given node. This is post-normalization of Text Nodes.

public int getPrevSibling (int nodeIndex, boolean free)

Returns the prev sibling of the given node.

Parameters
free True to free sibling index.

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.

public int getRealPrevSibling (int nodeIndex, boolean free)

Returns the real prev sibling of the given node.

Parameters
free True to free sibling index.

public Object getTypeInfo (int nodeIndex)

Clears the type info that is stored in the fNodeValue array

Returns
  • Object - type information for the attribute/element node

public int insertBefore (int parentIndex, int newChildIndex, int refChildIndex)

Inserts a child before the specified node in the table.

public int lookupElementDefinition (String elementName)

Returns the index of the element definition in the table with the specified name index, or -1 if no such definition exists.

public void print ()

Prints out the tables.

public void putIdentifier (String name, int elementNodeIndex)

Registers an identifier name with a specified element node.

public void setAsLastChild (int parentIndex, int childIndex)

Sets the last child of the parentIndex to childIndex.

public int setAttributeNode (int elemIndex, int attrIndex)

Adds an attribute node to the specified element.

public int setDeferredAttribute (int elementNodeIndex, String attrName, String attrURI, String attrValue, boolean specified)

This method is deprecated.
No replacement.

Sets an attribute on an element node.

public int setDeferredAttribute (int elementNodeIndex, String attrName, String attrURI, String attrValue, boolean specified, boolean id, Object type)

This method is used by the DOMParser to create attributes.

Returns
  • int

public void setEntityInfo (int currentEntityDecl, String version, String encoding)

public void setIdAttribute (int attrIndex)

Sets type of attribute

public void setIdAttributeNode (int elemIndex, int attrIndex)

Adds an attribute node to the specified element.

public void setInputEncoding (int currentEntityDecl, String value)

DOM Internal An attribute specifying the actual encoding of this document. This is null otherwise.
This attribute represents the property [character encoding scheme] defined in .

public void setInternalSubset (int doctypeIndex, String subset)

Protected Methods

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.

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.

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.

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.

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.

protected void synchronizeData ()

Synchronizes the node's data.