/** * Get the identity of this node in the tree * * @param nodeHandle The node handle. * @return the node identity * @xsl.usage internal */ public int getNodeIdent(int nodeHandle) { /*if (nodeHandle != DTM.NULL) return nodeHandle & m_mask; else return DTM.NULL;*/ return makeNodeIdentity(nodeHandle); }
/** * Get the identity of this node in the tree * * @param nodeHandle The node handle. * @return the node identity * @xsl.usage internal */ public int getNodeIdent(int nodeHandle) { /*if (nodeHandle != DTM.NULL) return nodeHandle & m_mask; else return DTM.NULL;*/ return makeNodeIdentity(nodeHandle); }
/** * Get the depth level of this node in the tree (equals 1 for * a parentless node). * * @param nodeHandle The node id. * @return the number of ancestors, plus one * @xsl.usage internal */ public short getLevel(int nodeHandle) { // Apparently, the axis walker stuff requires levels to count from 1. int identity = makeNodeIdentity(nodeHandle); return (short) (_level(identity) + 1); }
/** * Get the depth level of this node in the tree (equals 1 for * a parentless node). * * @param nodeHandle The node id. * @return the number of ancestors, plus one * @xsl.usage internal */ public short getLevel(int nodeHandle) { // Apparently, the axis walker stuff requires levels to count from 1. int identity = makeNodeIdentity(nodeHandle); return (short) (_level(identity) + 1); }
/** * Given a node handle, return an ID that represents the node's expanded name. * * @param nodeHandle The handle to the node in question. * * @return the expanded-name id of the node. */ public int getExpandedTypeID(int nodeHandle) { // %REVIEW% This _should_ only be null if someone asked the wrong DTM about the node... // which one would hope would never happen... int id=makeNodeIdentity(nodeHandle); if(id==NULL) return NULL; return _exptype(id); }
/** * Given a node handle, test if it has child nodes. * <p> %REVIEW% This is obviously useful at the DOM layer, where it * would permit testing this without having to create a proxy * node. It's less useful in the DTM API, where * (dtm.getFirstChild(nodeHandle)!=DTM.NULL) is just as fast and * almost as self-evident. But it's a convenience, and eases porting * of DOM code to DTM. </p> * * @param nodeHandle int Handle of the node. * @return int true if the given node has child nodes. */ public boolean hasChildNodes(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int firstChild = _firstch(identity); return firstChild != DTM.NULL; }
/** * Returns the namespace type of a specific node * @param nodeHandle the id of the node. * @return the ID of the namespace. */ public int getNamespaceType(final int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int expandedNameID = _exptype(identity); return m_expandedNameTable.getNamespaceID(expandedNameID); }
/** * Given a node handle, get the index of the node's first attribute. * * @param nodeHandle int Handle of the node. * @return Handle of first attribute, or DTM.NULL to indicate none exists. */ public int getFirstAttribute(int nodeHandle) { int nodeID = makeNodeIdentity(nodeHandle); return makeNodeHandle(getFirstAttributeIdentity(nodeID)); }
/** * Returns the namespace type of a specific node * @param nodeHandle the id of the node. * @return the ID of the namespace. */ public int getNamespaceType(final int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int expandedNameID = _exptype(identity); return m_expandedNameTable.getNamespaceID(expandedNameID); }
/** * Given a node handle, advance to its next sibling. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * @param nodeHandle int Handle of the node. * @return int Node-number of next sibling, * or DTM.NULL to indicate none exists. */ public int getNextSibling(int nodeHandle) { if (nodeHandle == DTM.NULL) return DTM.NULL; return makeNodeHandle(_nextsib(makeNodeIdentity(nodeHandle))); }
/** * Given a node handle, get the index of the node's first attribute. * * @param nodeHandle int Handle of the node. * @return Handle of first attribute, or DTM.NULL to indicate none exists. */ public int getFirstAttribute(int nodeHandle) { int nodeID = makeNodeIdentity(nodeHandle); return makeNodeHandle(getFirstAttributeIdentity(nodeID)); }
/** * Given a node handle, get the handle of the node's first child. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * * @param nodeHandle int Handle of the node. * @return int DTM node-number of first child, or DTM.NULL to indicate none exists. */ public int getFirstChild(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int firstChild = _firstch(identity); return makeNodeHandle(firstChild); }
/** * Given a node handle, return its DOM-style node type. * <p> * %REVIEW% Generally, returning short is false economy. Return int? * %REVIEW% Make assumption that node has already arrived. Is OK? * * @param nodeHandle The node id. * @return int Node type, as per the DOM's Node._NODE constants. */ public short getNodeType(int nodeHandle) { if (nodeHandle == DTM.NULL) return DTM.NULL; return m_expandedNameTable.getType(_exptype(makeNodeIdentity(nodeHandle))); }
/** * Given a node handle, find its parent node. * * @param nodeHandle the id of the node. * @return int Node-number of parent, * or DTM.NULL to indicate none exists. */ public int getParent(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); if (identity > 0) return makeNodeHandle(_parent(identity)); else return DTM.NULL; }
/** * Given a node handle, get the handle of the node's first child. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * * @param nodeHandle int Handle of the node. * @return int DTM node-number of first child, or DTM.NULL to indicate none exists. */ public int getFirstChild(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int firstChild = _firstch(identity); return makeNodeHandle(firstChild); }
/** * Given a node handle, advance to its next sibling. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * @param nodeHandle int Handle of the node. * @return int Node-number of next sibling, * or DTM.NULL to indicate none exists. */ public int getNextSibling(int nodeHandle) { if (nodeHandle == DTM.NULL) return DTM.NULL; return makeNodeHandle(_nextsib(makeNodeIdentity(nodeHandle))); }
/** * Given a node handle, return its DOM-style node type. * <p> * %REVIEW% Generally, returning short is false economy. Return int? * %REVIEW% Make assumption that node has already arrived. Is OK? * * @param nodeHandle The node id. * @return int Node type, as per the DOM's Node._NODE constants. */ public short getNodeType(int nodeHandle) { if (nodeHandle == DTM.NULL) return DTM.NULL; return m_expandedNameTable.getType(_exptype(makeNodeIdentity(nodeHandle))); }
/** * Given a node handle, find its parent node. * * @param nodeHandle the id of the node. * @return int Node-number of parent, * or DTM.NULL to indicate none exists. */ public int getParent(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); if (identity > 0) return makeNodeHandle(_parent(identity)); else return DTM.NULL; }
/** * Given a node handle, advance to the next attribute. * If an attr, we advance to * the next attr on the same node. If not an attribute, we return NULL. * * @param nodeHandle int Handle of the node. * @return int DTM node-number of the resolved attr, * or DTM.NULL to indicate none exists. */ public int getNextAttribute(int nodeHandle) { int nodeID = makeNodeIdentity(nodeHandle); if (_type(nodeID) == DTM.ATTRIBUTE_NODE) { return makeNodeHandle(getNextAttributeIdentity(nodeID)); } return DTM.NULL; }
/** * Given a node handle, advance to its next sibling. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * @param nodeHandle int Handle of the node. * @return int Node-number of next sibling, * or DTM.NULL to indicate none exists. */ public int getTypedNextSibling(int nodeHandle, int nodeType) { if (nodeHandle == DTM.NULL) return DTM.NULL; int node = makeNodeIdentity(nodeHandle); int eType; while ((node = _nextsib(node)) != DTM.NULL && ((eType = _exptype(node)) != nodeType && m_expandedNameTable.getType(eType)!= nodeType)); //_type(node) != nodeType)); return (node == DTM.NULL ? DTM.NULL : makeNodeHandle(node)); }