Class DTMDefaultBase
- All Implemented Interfaces:
DTM
- Direct Known Subclasses:
DTMDefaultBaseTraversers
DTMDefaultBase
class serves as a helper base for DTMs. It sets up structures for
navigation and type, while leaving data management and construction to the derived classes.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default block size of the node arraysstatic final int
The number of blocks for the node arraysstatic final int
The number of blocks used for small documents & RTFsprotected final String
The base URI for this document.protected final SuballocatedIntVector
The document identity number(s).protected int[][][]
These hold indexes to elements based on namespace and local name.protected final ExpandedNameTable
The table for exandedNameID lookups.protected final SuballocatedIntVector
The expanded names, one array element for each node.protected final SuballocatedIntVector
First child values, one array element for each node.protected final boolean
true if indexing is turned on.final DTMManager
The DTM manager who "owns" this DTM.protected DTMManagerDefault
m_mgr cast to DTMManagerDefault, or null if it isn't an instance (Efficiency hook)protected SuballocatedIntVector
SuballocatedIntVector of elements at which corresponding namespaceDeclSets were definedprotected List
<SuballocatedIntVector> Vector of SuballocatedIntVectors of NS decl setsprotected final SuballocatedIntVector
Next sibling values, one array element for each node.protected final SuballocatedIntVector
Previous sibling values, one array element for each node.protected SuballocatedIntVector
Previous sibling values, one array element for each node.protected int
The number of nodes, which is also used to determine the next node index.protected DTMAxisTraverser[]
Stateless axis traversers, lazely built.protected static final int
The value to use when the information has not been built yet.static final int
The identity of the root node.Fields inherited from interface org.loboevolution.apache.xml.dtm.DTM
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NAMESPACE_NODE, NOTATION_NODE, NTYPES, NULL, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
Constructor Summary
ConstructorDescriptionDTMDefaultBase
(DTMManager mgr, Source source, int dtmIdentity, boolean doIndexing) Construct a DTMDefaultBase object using the default block size.DTMDefaultBase
(DTMManager mgr, Source source, int dtmIdentity, boolean doIndexing, int blocksize, boolean usePrevsib) Construct a DTMDefaultBase object from a DOM node. -
Method Summary
Modifier and TypeMethodDescriptionprotected int
_exptype
(int identity) Get the expanded type ID for the given node identity.protected int
_firstch
(int identity) Get the first child for the given node identity.protected int
_level
(int identity) Get the level in the tree for the given node identity.protected int
_nextsib
(int identity) Get the next sibling for the given node identity.protected int
_parent
(int identity) Get the parent for the given node identity.protected int
_prevsib
(int identity) Get the previous sibling for the given node identity.protected short
_type
(int identity) Get the simple type ID for the given node identity.protected void
declareNamespaceInContext
(int elementNodeIndex, int namespaceNodeIndex) Build table of namespace declaration locations during DTM construction.dumpNode
(int nodeHandle) Diagnostics function to dump a single node.protected void
ensureSizeOfIndex
(int namespaceID, int LocalNameID) Ensure that the size of the element indexes can hold the information.protected void
Simple error for asserts and the like.protected int
findGTE
(int[] list, int start, int len, int value) Find the first index that occurs in the list that is greater than or equal to the given value.protected int
findInSortedSuballocatedIntVector
(SuballocatedIntVector vector, int lookfor) Subroutine: Locate the specified node within m_namespaceDeclSetElements, or the last element which preceeds it in document orderprotected SuballocatedIntVector
findNamespaceContext
(int elementNodeIndex) Retrieve list of namespace declaration locations active at this node.abstract int
getAttributeNode
(int nodeHandle, String namespaceURI, String name) Retrieves an attribute node by local name and namespace URIint
Given a DTM which contains only a single document, find the Node Handle of the Document node.int
getDocumentRoot
(int nodeHandle) Given a node handle, find the owning document node.abstract int
getElementById
(String elementId) Returns theElement
whoseID
is given byelementId
.int
getExpandedTypeID
(int nodeHandle) Given a node handle, return an ID that represents the node's expanded name.int
getExpandedTypeID
(String namespace, String localName, int type) Given an expanded name, return an ID.int
getFirstAttribute
(int nodeHandle) Given a node handle, get the index of the node's first attribute.protected int
getFirstAttributeIdentity
(int identity) Given a node identity, get the index of the node's first attribute.int
getFirstChild
(int nodeHandle) Given a node handle, get the handle of the node's first child.int
getFirstNamespaceNode
(int nodeHandle, boolean inScope) Given a node handle, get the index of the node's first namespace node.int
getLastChild
(int nodeHandle) Given a node handle, get the handle of the node's last child.abstract String
getLocalName
(int nodeHandle) Given a node handle, return its DOM-style localname.Query which DTMManager this DTM is currently being handled by.abstract String
getNamespaceURI
(int nodeHandle) Given a node handle, return its DOM-style namespace URI (As defined in Namespaces, this is the declared URI which this node's prefix -- or default in lieu thereof -- was mapped to.)int
getNextAttribute
(int nodeHandle) Given a node handle, advance to the next attribute.protected int
getNextAttributeIdentity
(int identity) Given a node identity for an attribute, advance to the next attribute.int
getNextNamespaceNode
(int baseHandle, int nodeHandle, boolean inScope) Given a namespace handle, advance to the next namespace in the same scope (local or local-plus-inherited, as selected by getFirstNamespaceNode)protected abstract int
getNextNodeIdentity
(int identity) Get the next node identity value in the list, and call the iterator if it hasn't been added yet.int
getNextSibling
(int nodeHandle) Given a node handle, advance to its next sibling.getNode
(int nodeHandle) Return an DOM node for the given node.abstract String
getNodeName
(int nodeHandle) Given a node handle, return its DOM-style node name.getNodeNameX
(int nodeHandle) Given a node handle, return the XPath node name.short
getNodeType
(int nodeHandle) Given a node handle, return its DOM-style node type.abstract String
getNodeValue
(int nodeHandle) Given a node handle, return its node value.int
getOwnerDocument
(int nodeHandle) Given a node handle, find the owning document node.int
getParent
(int nodeHandle) Given a node handle, find its parent node.abstract String
getPrefix
(int nodeHandle) Given a namespace handle, return the prefix that the namespace decl is mapping.int
getPreviousSibling
(int nodeHandle) Given a node handle, find its preceeding sibling.abstract XString
getStringValue
(int nodeHandle) Get the string-value of a node as a String object (see ... for the definition of a node's string-value).protected void
indexNode
(int expandedTypeID, int identity) Add a node to the element indexes.boolean
isNodeAfter
(int nodeHandle1, int nodeHandle2) Figure out whether nodeHandle2 should be considered as being later in the document than nodeHandle1, in Document Order as defined by the XPath model.final int
makeNodeHandle
(int nodeIdentity) Given a node identity, return a node handle.final int
makeNodeIdentity
(int nodeHandle) Given a node handle, return a node identity.protected abstract boolean
nextNode()
This method should try and build one or more nodes in the table.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.loboevolution.apache.xml.dtm.DTM
getAxisIterator, getAxisTraverser
-
Field Details
-
ROOTNODE
public static final int ROOTNODEThe identity of the root node.- See Also:
-
m_size
protected int m_sizeThe number of nodes, which is also used to determine the next node index. -
m_exptype
The expanded names, one array element for each node. -
m_firstch
First child values, one array element for each node. -
m_nextsib
Next sibling values, one array element for each node. -
m_prevsib
Previous sibling values, one array element for each node. -
m_parent
Previous sibling values, one array element for each node. -
m_namespaceDeclSets
Vector of SuballocatedIntVectors of NS decl sets -
m_namespaceDeclSetElements
SuballocatedIntVector of elements at which corresponding namespaceDeclSets were defined -
m_elemIndexes
protected int[][][] m_elemIndexesThese hold indexes to elements based on namespace and local name. The base lookup is the the namespace. The second lookup is the local name, and the last array contains the the first free element at the start, and the list of element handles following. -
DEFAULT_BLOCKSIZE
public static final int DEFAULT_BLOCKSIZEThe default block size of the node arrays- See Also:
-
DEFAULT_NUMBLOCKS
public static final int DEFAULT_NUMBLOCKSThe number of blocks for the node arrays- See Also:
-
DEFAULT_NUMBLOCKS_SMALL
public static final int DEFAULT_NUMBLOCKS_SMALLThe number of blocks used for small documents & RTFs- See Also:
-
NOTPROCESSED
protected static final int NOTPROCESSEDThe value to use when the information has not been built yet.- See Also:
-
m_mgr
The DTM manager who "owns" this DTM. -
m_mgrDefault
m_mgr cast to DTMManagerDefault, or null if it isn't an instance (Efficiency hook) -
m_dtmIdent
The document identity number(s). If we have overflowed the addressing range of the first that was assigned to us, we may add others. -
m_documentBaseURI
The base URI for this document. -
m_expandedNameTable
The table for exandedNameID lookups. This may or may not be the same table as is contained in the DTMManagerDefault. -
m_indexing
protected final boolean m_indexingtrue if indexing is turned on. -
m_traversers
Stateless axis traversers, lazely built.
-
-
Constructor Details
-
DTMDefaultBase
Construct a DTMDefaultBase object using the default block size.- Parameters:
mgr
- The DTMManager who owns this DTM.source
- The object that is used to specify the construction source.dtmIdentity
- The DTM identity ID for this DTM.doIndexing
- true if the caller considers it worth it to use indexing schemes.
-
DTMDefaultBase
public DTMDefaultBase(DTMManager mgr, Source source, int dtmIdentity, boolean doIndexing, int blocksize, boolean usePrevsib) Construct a DTMDefaultBase object from a DOM node.- Parameters:
mgr
- The DTMManager who owns this DTM.source
- The object that is used to specify the construction source.dtmIdentity
- The DTM identity ID for this DTM.doIndexing
- true if the caller considers it worth it to use indexing schemes.blocksize
- The block size of the DTM.usePrevsib
- true if we want to build the previous sibling node array.
-
-
Method Details
-
ensureSizeOfIndex
protected void ensureSizeOfIndex(int namespaceID, int LocalNameID) Ensure that the size of the element indexes can hold the information.- Parameters:
namespaceID
- Namespace ID index.LocalNameID
- Local name ID.
-
indexNode
protected void indexNode(int expandedTypeID, int identity) Add a node to the element indexes. The node will not be added unless it's an element.- Parameters:
expandedTypeID
- The expanded type ID of the node.identity
- The node identity index.
-
findGTE
protected int findGTE(int[] list, int start, int len, int value) Find the first index that occurs in the list that is greater than or equal to the given value.- Parameters:
list
- A list of integers.start
- The start index to begin the search.len
- The number of items to search.value
- Find the slot that has a value that is greater than or identical to this argument.- Returns:
- The index in the list of the slot that is higher or identical to the identity argument, or -1 if no node is higher or equal.
-
getNextNodeIdentity
protected abstract int getNextNodeIdentity(int identity) Get the next node identity value in the list, and call the iterator if it hasn't been added yet.- Parameters:
identity
- The node identity (index).- Returns:
- identity+1, or DTM.NULL.
-
nextNode
protected abstract boolean nextNode()This method should try and build one or more nodes in the table.- Returns:
- The true if a next node is found or false if there are no more nodes.
-
_type
protected short _type(int identity) Get the simple type ID for the given node identity.- Parameters:
identity
- The node identity.- Returns:
- The simple type ID, or DTM.NULL.
-
_exptype
protected int _exptype(int identity) Get the expanded type ID for the given node identity.- Parameters:
identity
- The node identity.- Returns:
- The expanded type ID, or DTM.NULL.
-
_level
protected int _level(int identity) Get the level in the tree for the given node identity.- Parameters:
identity
- The node identity.- Returns:
- The tree level, or DTM.NULL.
-
_firstch
protected int _firstch(int identity) Get the first child for the given node identity.- Parameters:
identity
- The node identity.- Returns:
- The first child identity, or DTM.NULL.
-
_nextsib
protected int _nextsib(int identity) Get the next sibling for the given node identity.- Parameters:
identity
- The node identity.- Returns:
- The next sibling identity, or DTM.NULL.
-
_prevsib
protected int _prevsib(int identity) Get the previous sibling for the given node identity.- Parameters:
identity
- The node identity.- Returns:
- The previous sibling identity, or DTM.NULL.
-
_parent
protected int _parent(int identity) Get the parent for the given node identity.- Parameters:
identity
- The node identity.- Returns:
- The parent identity, or DTM.NULL.
-
dumpNode
Diagnostics function to dump a single node.%REVIEW% KNOWN GLITCH: If you pass it a node index rather than a node handle, it works just fine... but the displayed identity number before the colon is different, which complicates comparing it with nodes printed the other way. We could always OR the DTM ID into the value, to suppress that distinction...
%REVIEW% This might want to be moved up to DTMDefaultBase, or possibly DTM itself, since it's a useful diagnostic and uses only DTM's public APIs.
-
makeNodeHandle
public final int makeNodeHandle(int nodeIdentity) Given a node identity, return a node handle. If extended addressing has been used (multiple DTM IDs), we need to map the high bits of the identity into the proper DTM ID.This has been made FINAL to facilitate inlining, since we do not expect any subclass of DTMDefaultBase to ever change the algorithm. (I don't really like doing so, and would love to have an excuse not to...)
%REVIEW% Is it worth trying to specialcase small documents? %REVIEW% Should this be exposed at the package/public layers?
- Parameters:
nodeIdentity
- Internal offset to this node's records.- Returns:
- NodeHandle (external representation of node)
-
makeNodeIdentity
public final int makeNodeIdentity(int nodeHandle) Given a node handle, return a node identity. If extended addressing has been used (multiple DTM IDs), we need to map the high bits of the identity into the proper DTM ID and thence find the proper offset to add to the low bits of the identityThis has been made FINAL to facilitate inlining, since we do not expect any subclass of DTMDefaultBase to ever change the algorithm. (I don't really like doing so, and would love to have an excuse not to...)
%OPT% Performance is critical for this operation.
%REVIEW% Should this be exposed at the package/public layers?
- Parameters:
nodeHandle
- (external representation of node)- Returns:
- nodeIdentity Internal offset to this node's records.
-
getFirstChild
public int getFirstChild(int nodeHandle) Given a node handle, get the handle of the node's first child.- Specified by:
getFirstChild
in interfaceDTM
- Parameters:
nodeHandle
- int Handle of the node.- Returns:
- int DTM node-number of first child, or DTM.NULL to indicate none exists.
-
getLastChild
public int getLastChild(int nodeHandle) Given a node handle, get the handle of the node's last child.- Specified by:
getLastChild
in interfaceDTM
- Parameters:
nodeHandle
- int Handle of the node.- Returns:
- int Node-number of last child, or DTM.NULL to indicate none exists.
-
getAttributeNode
Retrieves an attribute node by local name and namespace URI%TBD% Note that we currently have no way to support the DOM's old getAttribute() call, which accesses only the qname.
- Specified by:
getAttributeNode
in interfaceDTM
- Parameters:
nodeHandle
- Handle of the node upon which to look up this attribute.namespaceURI
- The namespace URI of the attribute to retrieve, or null.name
- The local name of the attribute to retrieve.- Returns:
- The attribute node handle with the specified name (
nodeName
) orDTM.NULL
if there is no such attribute.
-
getFirstAttribute
public int getFirstAttribute(int nodeHandle) Given a node handle, get the index of the node's first attribute.- Specified by:
getFirstAttribute
in interfaceDTM
- Parameters:
nodeHandle
- int Handle of the node.- Returns:
- Handle of first attribute, or DTM.NULL to indicate none exists.
-
getFirstAttributeIdentity
protected int getFirstAttributeIdentity(int identity) Given a node identity, get the index of the node's first attribute.- Parameters:
identity
- int identity of the node.- Returns:
- Identity of first attribute, or DTM.NULL to indicate none exists.
-
getNextSibling
public int getNextSibling(int nodeHandle) Given a node handle, advance to its next sibling.- Specified by:
getNextSibling
in interfaceDTM
- Parameters:
nodeHandle
- int Handle of the node.- Returns:
- int Node-number of next sibling, or DTM.NULL to indicate none exists.
-
getPreviousSibling
public int getPreviousSibling(int nodeHandle) Given a node handle, find its preceeding sibling. WARNING: DTM implementations may be asymmetric; in some, this operation has been resolved by search, and is relatively expensive.- Specified by:
getPreviousSibling
in interfaceDTM
- Parameters:
nodeHandle
- the id of the node.- Returns:
- int Node-number of the previous sib, or DTM.NULL to indicate none exists.
-
getNextAttribute
public int getNextAttribute(int nodeHandle) Given a node handle, advance to the next attribute. If an element, we advance to its first attribute; if an attr, we advance to the next attr of the same element.- Specified by:
getNextAttribute
in interfaceDTM
- Parameters:
nodeHandle
- int Handle of the node.- Returns:
- int DTM node-number of the resolved attr, or DTM.NULL to indicate none exists.
-
getNextAttributeIdentity
protected int getNextAttributeIdentity(int identity) Given a node identity for an attribute, advance to the next attribute.- Parameters:
identity
- int identity of the attribute node. This must be an attribute node.- Returns:
- int DTM node-identity of the resolved attr, or DTM.NULL to indicate none exists.
-
declareNamespaceInContext
protected void declareNamespaceInContext(int elementNodeIndex, int namespaceNodeIndex) Build table of namespace declaration locations during DTM construction. Table is a Vector of SuballocatedIntVectors containing the namespace node HANDLES declared at that ID, plus an SuballocatedIntVector of the element node INDEXES at which these declarations appeared.NOTE: Since this occurs during model build, nodes will be encountered in doucment order and thus the table will be ordered by element, permitting binary-search as a possible retrieval optimization.
%REVIEW% Directly managed arrays rather than vectors? %REVIEW% Handles or IDs? Given usage, I think handles.
-
findNamespaceContext
Retrieve list of namespace declaration locations active at this node. List is an SuballocatedIntVector whose entries are the namespace node HANDLES declared at that ID.%REVIEW% Directly managed arrays rather than vectors? %REVIEW% Handles or IDs? Given usage, I think handles.
-
findInSortedSuballocatedIntVector
Subroutine: Locate the specified node within m_namespaceDeclSetElements, or the last element which preceeds it in document order%REVIEW% Inlne this into findNamespaceContext? Create SortedSuballocatedIntVector type?
- Parameters:
vector
- the vectorlookfor
- the lookfor- Returns:
- If positive or zero, the index of the found item. If negative, index of the point at which it would have appeared, encoded as -1-index and hence reconvertable by subtracting it from -1. (Encoding because I don't want to recompare the strings but don't want to burn bytes on a datatype to hold a flagged value.)
-
getFirstNamespaceNode
public int getFirstNamespaceNode(int nodeHandle, boolean inScope) Given a node handle, get the index of the node's first namespace node.- Specified by:
getFirstNamespaceNode
in interfaceDTM
- Parameters:
nodeHandle
- handle to node, which should probably be an element node, but need not be.inScope
- true if all namespaces in scope should be returned, false if only the node's own namespace declarations should be returned.- Returns:
- handle of first namespace, or DTM.NULL to indicate none exists.
-
getNextNamespaceNode
public int getNextNamespaceNode(int baseHandle, int nodeHandle, boolean inScope) Given a namespace handle, advance to the next namespace in the same scope (local or local-plus-inherited, as selected by getFirstNamespaceNode)- Specified by:
getNextNamespaceNode
in interfaceDTM
- Parameters:
baseHandle
- handle to original node from where the first child was relative to (needed to return nodes in document order).nodeHandle
- handle to node which must be of type NAMESPACE_NODE. NEEDSDOC @param inScope- Returns:
- handle of next namespace, or DTM.NULL to indicate none exists.
-
getParent
public int getParent(int nodeHandle) Given a node handle, find its parent node. -
getDocument
public int getDocument()Given a DTM which contains only a single document, find the Node Handle of the Document node. Note that if the DTM is configured so it can contain multiple documents, this call will return the Document currently under construction -- but may return null if it's between documents. Generally, you should use getOwnerDocument(nodeHandle) or getDocumentRoot(nodeHandle) instead.- Specified by:
getDocument
in interfaceDTM
- Returns:
- int Node handle of document, or DTM.NULL if a shared DTM can not tell us which Document is currently active.
-
getOwnerDocument
public int getOwnerDocument(int nodeHandle) Given a node handle, find the owning document node. This version mimics the behavior of the DOM call by the same name.- Specified by:
getOwnerDocument
in interfaceDTM
- Parameters:
nodeHandle
- the id of the node.- Returns:
- int Node handle of owning document, or DTM.NULL if the node was a Document.
- See Also:
-
getDocumentRoot
public int getDocumentRoot(int nodeHandle) Given a node handle, find the owning document node.- Specified by:
getDocumentRoot
in interfaceDTM
- Parameters:
nodeHandle
- the id of the node.- Returns:
- int Node handle of owning document, or the node itself if it was a Document. (Note difference from DOM, where getOwnerDocument returns null for the Document node.)
- See Also:
-
getStringValue
Get the string-value of a node as a String object (see ... for the definition of a node's string-value).- Specified by:
getStringValue
in interfaceDTM
- Parameters:
nodeHandle
- The node ID.- Returns:
- A string object that represents the string-value of the given node.
-
getExpandedTypeID
public int getExpandedTypeID(int nodeHandle) Given a node handle, return an ID that represents the node's expanded name.- Specified by:
getExpandedTypeID
in interfaceDTM
- Parameters:
nodeHandle
- The handle to the node in question.- Returns:
- the expanded-name id of the node.
-
getExpandedTypeID
Given an expanded name, return an ID. If the expanded-name does not exist in the internal tables, the entry will be created, and the ID will be returned. Any additional nodes that are created that have this expanded name will use this ID.NEEDSDOC @param namespace NEEDSDOC @param localName NEEDSDOC @param type
- Specified by:
getExpandedTypeID
in interfaceDTM
- Returns:
- the expanded-name id of the node.
-
getNodeName
Given a node handle, return its DOM-style node name. This will include names such as #text or #document.- Specified by:
getNodeName
in interfaceDTM
- Parameters:
nodeHandle
- the id of the node.- Returns:
- String Name of this node, which may be an empty string. %REVIEW% Document when empty string is possible...
-
getNodeNameX
Given a node handle, return the XPath node name. This should be the name as described by the XPath data model, NOT the DOM-style name.- Specified by:
getNodeNameX
in interfaceDTM
- Parameters:
nodeHandle
- the id of the node.- Returns:
- String Name of this node.
-
getLocalName
Given a node handle, return its DOM-style localname. (As defined in Namespaces, this is the portion of the name after the prefix, if present, or the whole node name if no prefix exists)- Specified by:
getLocalName
in interfaceDTM
- Parameters:
nodeHandle
- the id of the node.- Returns:
- String Local name of this node.
-
getPrefix
Given a namespace handle, return the prefix that the namespace decl is mapping. Given a node handle, return the prefix used to map to the namespace. (As defined in Namespaces, this is the portion of the name before any colon character).%REVIEW% Are you sure you want "" for no prefix?
-
getNamespaceURI
Given a node handle, return its DOM-style namespace URI (As defined in Namespaces, this is the declared URI which this node's prefix -- or default in lieu thereof -- was mapped to.)- Specified by:
getNamespaceURI
in interfaceDTM
- Parameters:
nodeHandle
- the id of the node.- Returns:
- String URI value of this node's namespace, or null if no namespace was resolved.
-
getNodeValue
Given a node handle, return its node value. This is mostly as defined by the DOM, but may ignore some conveniences.- Specified by:
getNodeValue
in interfaceDTM
- Parameters:
nodeHandle
- The node id.- Returns:
- String Value of this node, or null if not meaningful for this node type.
-
getNodeType
public short getNodeType(int nodeHandle) Given a node handle, return its DOM-style node type.%REVIEW% Generally, returning short is false economy. Return int?
- Specified by:
getNodeType
in interfaceDTM
- Parameters:
nodeHandle
- The node id.- Returns:
- int Node type, as per the DOM's Node._NODE constants.
-
getElementById
Returns theElement
whoseID
is given byelementId
. If no such element exists, returnsDTM.NULL
. Behavior is not defined if more than one element has thisID
. Attributes (including those with the name "ID") are not of type ID unless so defined by DTD/Schema information available to the DTM implementation. Implementations that do not know whether attributes are of type ID or not are expected to returnDTM.NULL
.%REVIEW% Presumably IDs are still scoped to a single document, and this operation searches only within a single document, right? Wouldn't want collisions between DTMs in the same process.
- Specified by:
getElementById
in interfaceDTM
- Parameters:
elementId
- The uniqueid
value for an element.- Returns:
- The handle of the matching element.
-
isNodeAfter
public boolean isNodeAfter(int nodeHandle1, int nodeHandle2) Figure out whether nodeHandle2 should be considered as being later in the document than nodeHandle1, in Document Order as defined by the XPath model. This may not agree with the ordering defined by other XML applications.There are some cases where ordering isn't defined, and neither are the results of this function -- though we'll generally return true.
%REVIEW% Make sure this does the right thing with attribute nodes!!!
%REVIEW% Consider renaming for clarity. Perhaps isDocumentOrder(a,b)?
- Specified by:
isNodeAfter
in interfaceDTM
- Parameters:
nodeHandle1
- DOM Node to perform position comparison on.nodeHandle2
- DOM Node to perform position comparison on.- Returns:
- false if secondNode comes before firstNode, otherwise return true. You can think of
this as
(firstNode.documentOrderPosition <= secondNode.documentOrderPosition)
.
-
getNode
Return an DOM node for the given node. -
error
Simple error for asserts and the like.- Parameters:
msg
- Error message to report.
-
getManager
Query which DTMManager this DTM is currently being handled by.%REVEW% Should this become part of the base DTM API?
- Returns:
- a DTMManager, or null if this is a "stand-alone" DTM.
-