APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.org.apache.xml.internal.dtm.ref.sax2dtm

public Class SAX2DTM2

extends SAX2DTM
Class Inheritance
Known Direct Subclasses
com.sun.org.apache.xalan.internal.xsltc.dom.SAXImpl
Imports
com.sun.org.apache.xml.internal.dtm.DTM, .DTMAxisIterator, .DTMException, .DTMManager, .DTMWSFilter, com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase, .ExpandedNameTable, .ExtendedType, com.sun.org.apache.xml.internal.res.XMLErrorResources, .XMLMessages, com.sun.org.apache.xml.internal.serializer.SerializationHandler, com.sun.org.apache.xml.internal.utils.FastStringBuffer, .SuballocatedIntVector, .XMLString, .XMLStringDefault, .XMLStringFactory, java.util.ArrayList, .List, javax.xml.transform.Source, org.xml.sax.Attributes, .ContentHandler, .SAXException

SAX2DTM2 is an optimized version of SAX2DTM which is used in non-incremental situation. It is used as the super class of the XSLTC SAXImpl. Many of the interfaces in SAX2DTM and DTMDefaultBase are overridden in SAX2DTM2 in order to allow fast, efficient access to the DTM model. Some nested iterators in DTMDefaultBaseIterators are also overridden in SAX2DTM2 for performance reasons.

Performance is the biggest consideration in the design of SAX2DTM2. To make the code most efficient, the incremental support is dropped in SAX2DTM2, which means that you should not use it in incremental situation. To reduce the overhead of pulling data from the DTM model, a few core interfaces in SAX2DTM2 have direct access to the internal arrays of the SuballocatedIntVectors.

The design of SAX2DTM2 may limit its extensibilty. If you have a reason to extend the SAX2DTM model, please extend from SAX2DTM instead of this class.

%MK% The code in this class is critical to the XSLTC_DTM performance. Be very careful when making changes here!

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
SAX2DTM2.AncestorIterator

Iterator that returns the ancestors of a given node in document order.

public class
SAX2DTM2.AttributeIterator

Iterator that returns attribute nodes (of what nodes?)

public class
SAX2DTM2.ChildrenIterator

Iterator that returns all immediate children of a given node

public class
SAX2DTM2.DescendantIterator

Iterator that returns the descendants of a given node.

public class
SAX2DTM2.FollowingIterator

Iterator that returns following nodes of for a given node.

public class
SAX2DTM2.FollowingSiblingIterator

Iterator that returns all siblings of a given node.

public class
SAX2DTM2.ParentIterator

Iterator that returns the parent of a given node.

public class
SAX2DTM2.PrecedingIterator

Iterator that returns preceding nodes of a given node.

public class
SAX2DTM2.PrecedingSiblingIterator

Iterator that returns preceding siblings of a given node

public class
SAX2DTM2.TypedAncestorIterator

Typed iterator that returns the ancestors of a given node.

public class
SAX2DTM2.TypedAttributeIterator

Iterator that returns attribute nodes of a given type

public class
SAX2DTM2.TypedChildrenIterator

Iterator that returns children of a given type for a given node.

public class
SAX2DTM2.TypedDescendantIterator

Typed iterator that returns the descendants of a given node.

public class
SAX2DTM2.TypedFollowingIterator

Iterator that returns following nodes of a given type for a given node.

public class
SAX2DTM2.TypedFollowingSiblingIterator

Iterator that returns all following siblings of a given node.

public class
SAX2DTM2.TypedPrecedingIterator

Iterator that returns preceding nodes of agiven type for a given node.

public class
SAX2DTM2.TypedPrecedingSiblingIterator

Iterator that returns preceding siblings of a given type for a given node

public class
SAX2DTM2.TypedRootIterator

Iterator that returns the namespace nodes as defined by the XPath data model for a given node, filtered by extended type ID.

public class
SAX2DTM2.TypedSingletonIterator

Iterator that returns a given node only if it is of a given type.

Field Summary

Modifier and TypeField and Description
private static final String
private static final XMLString
protected int
protected boolean
private int[][]
private int[]
m_exptype_map0

End of nested iterators

protected ExtendedType[]
private int[][]
private int[]
protected int
private int
private int[][]
private int[]
private int[][]
private int[]
protected int
private int
protected List<String>
protected static final int
TEXT_LENGTH_BITS

%OPT% If the offset and length of a Text node are within certain limits, we store a bitwise encoded value into an int, using 10 bits (max.

protected static final int
protected static final int
protected static final int
Inherited from com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM:
m_charsm_coalescedTextTypem_contextIndexesm_datam_dataOrQNamem_endDocumentOccuredm_idAttributesm_insideDTDm_locatorm_parentsm_pastFirstElementm_prefixMappingsm_previousm_sourceColumnm_sourceLinem_sourceSystemIdm_textPendingStartm_textTypem_useSourceLocationPropertym_valuesOrPrefixesm_walker

Constructor Summary

AccessConstructor and Description
public
SAX2DTM2(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing)

Construct a SAX2DTM2 object using the default block size.

public
SAX2DTM2(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing, int blocksize, boolean usePrevsib, boolean buildIdIndex, boolean newNameTable)

Construct a SAX2DTM2 object using the given block size.

Method Summary

Modifier and TypeMethod and Description
public final int
_exptype(int identity)

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase._exptype.

Override DTMDefaultBase._exptype() by dropping the incremental code.

public final int
_exptype2(int
A node identity, which must not be equal to DTM.NULL
identity
)

The optimized version of DTMDefaultBase._exptype().

public final int
_exptype2Type(int exptype)

Return the node type from the expanded type

public final int
_firstch2(int
A node identity, which must not be equal to DTM.NULL
identity
)

The optimized version of DTMDefaultBase._firstch().

public final int
_nextsib2(int
A node identity, which must not be equal to DTM.NULL
identity
)

The optimized version of DTMDefaultBase._nextsib().

public final int
_parent2(int
A node identity, which must not be equal to DTM.NULL
identity
)

The optimized version of DTMDefaultBase._parent().

public final int
_type2(int
A node identity, which must not be equal to DTM.NULL
identity
)

The optimized version of DTMDefaultBase._type().

protected final int

Returns:

The index identity of the node that was added.
addNode
(int
raw type ID, one of DTM.XXX_NODE.
type
,
int
The expended type ID.
expandedTypeID
,
int
The current parent index.
parentIndex
,
int
The previous sibling index.
previousSibling
,
int
index into m_data table, or string handle.
dataOrPrefix
,
boolean
true if the node can have a first child, false if it is atomic.
canHaveFirstChild
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.addNode.

Construct the node map from the node.

protected final void
charactersFlush()

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.charactersFlush.

Check whether accumulated text should be stripped; if not, append the appropriate flavor of text/cdata node.

public void
comment(char[]
An array holding the characters in the comment.
ch
,
int
The starting position in the array.
start
,
int
The number of characters to use from the array.
length
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.comment.

Implements org.xml.sax.ext.LexicalHandler.comment.

Report an XML comment anywhere in the document.

protected final void
copyAttribute(int
The node identity
nodeID
,
int
The expanded type of the Element node
exptype
,
SerializationHandler
The SerializationHandler
handler
)

Copy an Attribute node to a SerializationHandler

protected final void
copyAttributes(final int
The Element node identity
nodeID
,
SerializationHandler
The SerializationHandler
handler
)

Copy attribute nodes from an element .

protected final String

Returns:

The qualified name of the Element node.
copyElement
(int
The node identity
nodeID
,
int
The expanded type of the Element node
exptype
,
SerializationHandler
The SerializationHandler
handler
)

Copy an Element node to a SerializationHandler.

protected final void
copyNS(final int
The Element node identity
nodeID
,
SerializationHandler
The SerializationHandler
handler
,
boolean
true if all namespaces in scope should be copied, false if only the namespace declarations should be copied.
inScope
)

Copy namespace nodes.

protected final void
copyTextNode(final int nodeID, SerializationHandler handler)

Copy the String value of a Text node to a SerializationHandler

public final void
dispatchCharactersEvents(int
The node ID.
nodeHandle
,
ContentHandler
A non-null reference to a ContentHandler.
ch
,
boolean
true if the content should be normalized according to the rules for the XPath normalize-space function.
normalize
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.dispatchCharactersEvents.

Implements com.sun.org.apache.xml.internal.dtm.DTM.dispatchCharactersEvents.

The optimized version of SAX2DTM.dispatchCharactersEvents(int, ContentHandler, boolean).

public void
public void
endElement(String
The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
uri
,
String
The local name (without prefix), or the empty string if Namespace processing is not being performed.
localName
,
String
The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.
qName
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.

public final int
getExpandedTypeID2(int nodeHandle)

The optimized version of DTMDefaultBase.getExpandedTypeID(int).

public final int

Returns:

Handle of first attribute, or DTM.NULL to indicate none exists.
getFirstAttribute
(int
int Handle of the node.
nodeHandle
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase.getFirstAttribute.

Implements com.sun.org.apache.xml.internal.dtm.DTM.getFirstAttribute.

The optimized version of DTMDefaultBase.getFirstAttribute().

protected int

Returns:

Identity of first attribute, or DTM.NULL to indicate none exists.
getFirstAttributeIdentity
(int
int identity of the node.
identity
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase.getFirstAttributeIdentity.

The optimized version of DTMDefaultBase.getFirstAttributeIdentity(int).

public int

Returns:

The prefix if there is one, or null.
getIdForNamespace
(String
The namespace URI, which may be null.
uri
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.getIdForNamespace.

Get a prefix either from the uri mapping, or just make one up!

public String

Returns:

String Local name of this node.
getLocalName
(int
the id of the node.
nodeHandle
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.getLocalName.

Implements com.sun.org.apache.xml.internal.dtm.DTM.getLocalName.

Override SAX2DTM.getLocalName() in SAX2DTM2.

protected int

Returns:

int DTM node-identity of the resolved attr, or DTM.NULL to indicate none exists.
getNextAttributeIdentity
(int
int identity of the attribute node. This must be an attribute node.
identity
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase.getNextAttributeIdentity.

The optimized version of DTMDefaultBase.getNextAttributeIdentity(int).

protected final int

Returns:

The namespace node immediately following the base node.
getNextNamespaceNode2
(int baseID)

Return the next namespace node following the given base node.

public String

Returns:

String Name of this node, which may be an empty string. %REVIEW% Document when empty string is possible... %REVIEW-COMMENT% It should never be empty, should it?
getNodeName
(int
the id of the node.
nodeHandle
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.getNodeName.

Implements com.sun.org.apache.xml.internal.dtm.DTM.getNodeName.

The optimized version of SAX2DTM.getNodeName().

public final String

Returns:

String Name of this node, which may be an empty string.
getNodeNameX
(int
the id of the node.
nodeHandle
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.getNodeNameX.

Implements com.sun.org.apache.xml.internal.dtm.DTM.getNodeNameX.

The optimized version of SAX2DTM.getNodeNameX().

public String

Returns:

String Value of this node, or null if not meaningful for this node type.
getNodeValue
(int
The node id.
nodeHandle
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.getNodeValue.

Implements com.sun.org.apache.xml.internal.dtm.DTM.getNodeValue.

Given a node handle, return its node value.

public XMLString

Returns:

A string object that represents the string-value of the given node.
getStringValue
(int
The node ID.
nodeHandle
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.getStringValue.

Implements com.sun.org.apache.xml.internal.dtm.DTM.getStringValue.

Override SAX2DTM.getStringValue(int)

This method is only used by Xalan-J Interpretive.

public String
getStringValue()

Returns the string value of the entire tree

public final String

Returns:

A string object that represents the string-value of the given node.
getStringValueX
(final int
The node ID.
nodeHandle
)

The optimized version of SAX2DTM.getStringValue(int).

protected final int

Returns:

Handle of attribute of the required type, or DTM.NULL to indicate none exists.
getTypedAttribute
(int
int Handle of the node.
nodeHandle
,
int
int expanded type ID of the required attribute.
attType
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase.getTypedAttribute.

The optimized version of DTMDefaultBase.getTypedAttribute(int, int).

public void
processingInstruction(String
The processing instruction target.
target
,
String
The processing instruction data, or null if none is supplied.
data
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.processingInstruction.

Implements org.xml.sax.ContentHandler.processingInstruction.

Override the processingInstruction() interface in SAX2DTM2.

public void
startDocument()

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.startDocument.

Implements org.xml.sax.ContentHandler.startDocument.

Receive notification of the beginning of the document.

public void
startElement(String
The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
uri
,
String
The local name (without prefix), or the empty string if Namespace processing is not being performed.
localName
,
String
The qualified name (with prefix), or the empty string if qualified names are not available.
qName
,
Attributes
The specified or defaulted attributes.
attributes
)

Overrides com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Override SAX2DTM.startElement()

Receive notification of the start of an element.

Inherited from com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM:
_dataOrQNameaddNewDTMIDattributeDeclcharactersclearCoRoutineclearCoRoutinedeclAlreadyDeclareddispatchToEventselementDeclendCDATAendDTDendEntityendPrefixMappingerrorexternalEntityDeclfatalErrorgetAttributeNodegetContentHandlergetDeclHandlergetDocumentTypeDeclarationPublicIdentifiergetDocumentTypeDeclarationSystemIdentifiergetDTDHandlergetElementByIdgetEntityResolvergetErrorHandlergetFixedNamesgetLexicalHandlergetNamespaceURIgetNamespaceURIgetNextNodeIdentitygetNumberOfNodesgetPrefixgetPrefixgetSourceLocatorForgetUnparsedEntityURIignorableWhitespaceinternalEntityDeclisAttributeSpecifiedisWhitespacemigrateToneedsTwoThreadsnextNodenotationDeclresolveEntitysetDocumentLocatorsetIDAttributesetIncrementalSAXSourcesetPropertysetSourceLocationsetUseSourceLocationskippedEntitystartCDATAstartDTDstartEntitystartPrefixMappingunparsedEntityDeclwarning