com.sun.org.apache.xml.internal.dtm.Axis Java Examples
The following examples show how to use
com.sun.org.apache.xml.internal.dtm.Axis.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiDOM.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public DTMAxisIterator setStartNode(final int node) { if (node == DTM.NULL) { return this; } int dom = node >>> DTMManager.IDENT_DTM_NODE_BITS; // Get a new source first time and when mask changes if (_source == null || _dtmId != dom) { if (_type == NO_TYPE) { _source = _adapters[dom].getAxisIterator(_axis); } else if (_axis == Axis.CHILD) { _source = _adapters[dom].getTypedChildren(_type); } else { _source = _adapters[dom].getTypedAxisIterator(_axis, _type); } } _dtmId = dom; _source.setStartNode(node); return this; }
Example #2
Source File: SimpleResultTreeImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public DTMAxisIterator getAxisIterator(final int axis) { switch (axis) { case Axis.CHILD: case Axis.DESCENDANT: return new SimpleIterator(SimpleIterator.DIRECTION_DOWN); case Axis.PARENT: case Axis.ANCESTOR: return new SimpleIterator(SimpleIterator.DIRECTION_UP); case Axis.ANCESTORORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_UP)).includeSelf(); case Axis.DESCENDANTORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN)).includeSelf(); case Axis.SELF: return new SingletonIterator(); default: return EMPTY_ITERATOR; } }
Example #3
Source File: SimpleResultTreeImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public DTMAxisIterator getTypedAxisIterator(final int axis, final int type) { switch (axis) { case Axis.CHILD: case Axis.DESCENDANT: return new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type); case Axis.PARENT: case Axis.ANCESTOR: return new SimpleIterator(SimpleIterator.DIRECTION_UP, type); case Axis.ANCESTORORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_UP, type)).includeSelf(); case Axis.DESCENDANTORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type)).includeSelf(); case Axis.SELF: return new SingletonIterator(type); default: return EMPTY_ITERATOR; } }
Example #4
Source File: CastExpr.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Construct a cast expression and check that the conversion is * valid by calling typeCheck(). */ public CastExpr(Expression left, Type type) throws TypeCheckError { _left = left; _type = type; // use inherited field if ((_left instanceof Step) && (_type == Type.Boolean)) { Step step = (Step)_left; if ((step.getAxis() == Axis.SELF) && (step.getNodeType() != -1)) _typeTest = true; } // check if conversion is valid setParser(left.getParser()); setParent(left.getParent()); left.setParent(this); typeCheck(left.getParser().getSymbolTable()); }
Example #5
Source File: ChildTestIterator.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); m_traverser = m_cdtm.getAxisTraverser(Axis.CHILD); // String localName = getLocalName(); // String namespace = getNamespace(); // int what = m_whatToShow; // // System.out.println("what: "); // // NodeTest.debugWhatToShow(what); // if(DTMFilter.SHOW_ALL == what || // ((DTMFilter.SHOW_ELEMENT & what) == 0) // || localName == NodeTest.WILD // || namespace == NodeTest.WILD) // { // m_extendedTypeID = 0; // } // else // { // int type = getNodeTypeTest(what); // m_extendedTypeID = m_cdtm.getExpandedTypeID(namespace, localName, type); // } }
Example #6
Source File: ChildTestIterator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); m_traverser = m_cdtm.getAxisTraverser(Axis.CHILD); // String localName = getLocalName(); // String namespace = getNamespace(); // int what = m_whatToShow; // // System.out.println("what: "); // // NodeTest.debugWhatToShow(what); // if(DTMFilter.SHOW_ALL == what || // ((DTMFilter.SHOW_ELEMENT & what) == 0) // || localName == NodeTest.WILD // || namespace == NodeTest.WILD) // { // m_extendedTypeID = 0; // } // else // { // int type = getNodeTypeTest(what); // m_extendedTypeID = m_cdtm.getExpandedTypeID(namespace, localName, type); // } }
Example #7
Source File: KeyIndex.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * <p>Given a context node and the second argument to the XSLT * <code>key</code> function, checks whether the context node is in the * set of nodes that results from that reference to the <code>key</code> * function. This is used in the implementation of key patterns.</p> * <p>This particular {@link KeyIndex} object is the result evaluating the * first argument to the <code>key</code> function, so it's not taken into * any further account.</p> * * @param node The context node * @param value The second argument to the <code>key</code> function * @return <code>1</code> if and only if the context node is in the set of * nodes returned by the reference to the <code>key</code> function; * <code>0</code>, otherwise */ public int containsKey(int node, Object value) { int rootHandle = _dom.getAxisIterator(Axis.ROOT) .setStartNode(node).next(); // Get the mapping table for the document containing the context node Hashtable index = (Hashtable) _rootToIndexMap.get(new Integer(rootHandle)); // Check whether the context node is present in the set of nodes // returned by the key function if (index != null) { final IntegerArray nodes = (IntegerArray) index.get(value); return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0; } // The particular key name identifies no nodes in this document return 0; }
Example #8
Source File: MultiDOM.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public DTMAxisIterator setStartNode(final int node) { if (node == DTM.NULL) { return this; } int dom = node >>> DTMManager.IDENT_DTM_NODE_BITS; // Get a new source first time and when mask changes if (_source == null || _dtmId != dom) { if (_type == NO_TYPE) { _source = _adapters[dom].getAxisIterator(_axis); } else if (_axis == Axis.CHILD) { _source = _adapters[dom].getTypedChildren(_type); } else { _source = _adapters[dom].getTypedAxisIterator(_axis, _type); } } _dtmId = dom; _source.setStartNode(node); return this; }
Example #9
Source File: SAXImpl.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Constructor NamespaceWildcard * * @param axis The axis that this iterator will traverse * @param nsType The namespace type index */ public NamespaceWildcardIterator(int axis, int nsType) { m_nsType = nsType; // Create a nested iterator that will select nodes of // the principal node kind for the selected axis. switch (axis) { case Axis.ATTRIBUTE: { // For "attribute::p:*", the principal node kind is // attribute m_baseIterator = getAxisIterator(axis); } case Axis.NAMESPACE: { // This covers "namespace::p:*". It is syntactically // correct, though it doesn't make much sense. m_baseIterator = getAxisIterator(axis); } default: { // In all other cases, the principal node kind is // element m_baseIterator = getTypedAxisIterator(axis, DTM.ELEMENT_NODE); } } }
Example #10
Source File: UnionPathExpr.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void setParser(Parser parser) { super.setParser(parser); // find all expressions in this Union final Vector components = new Vector(); flatten(components); final int size = components.size(); _components = (Expression[])components.toArray(new Expression[size]); for (int i = 0; i < size; i++) { _components[i].setParser(parser); _components[i].setParent(this); if (_components[i] instanceof Step) { final Step step = (Step)_components[i]; final int axis = step.getAxis(); final int type = step.getNodeType(); // Put attribute iterators first if ((axis == Axis.ATTRIBUTE) || (type == DTM.ATTRIBUTE_NODE)) { _components[i] = _components[0]; _components[0] = step; } // Check if the union contains a reverse iterator if (Axis.isReverse(axis)) _reverse = true; } } // No need to reverse anything if another expression lies on top of this if (getParent() instanceof Expression) _reverse = false; }
Example #11
Source File: UnionPathExpr.java From JDKSourceCode1.8 with MIT License | 6 votes |
public void setParser(Parser parser) { super.setParser(parser); // find all expressions in this Union final Vector components = new Vector(); flatten(components); final int size = components.size(); _components = (Expression[])components.toArray(new Expression[size]); for (int i = 0; i < size; i++) { _components[i].setParser(parser); _components[i].setParent(this); if (_components[i] instanceof Step) { final Step step = (Step)_components[i]; final int axis = step.getAxis(); final int type = step.getNodeType(); // Put attribute iterators first if ((axis == Axis.ATTRIBUTE) || (type == DTM.ATTRIBUTE_NODE)) { _components[i] = _components[0]; _components[0] = step; } // Check if the union contains a reverse iterator if (Axis.isReverse(axis)) _reverse = true; } } // No need to reverse anything if another expression lies on top of this if (getParent() instanceof Expression) _reverse = false; }
Example #12
Source File: SAXImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Do not think that this returns an iterator for the namespace axis. * It returns an iterator with nodes that belong in a certain namespace, * such as with <xsl:apply-templates select="blob/foo:*"/> * The 'axis' specifies the axis for the base iterator from which the * nodes are taken, while 'ns' specifies the namespace URI type. */ public DTMAxisIterator getNamespaceAxisIterator(int axis, int ns) { if (ns == NO_TYPE) { return EMPTYITERATOR; } else { switch (axis) { case Axis.CHILD: return new NamespaceChildrenIterator(ns); case Axis.ATTRIBUTE: return new NamespaceAttributeIterator(ns); default: return new NamespaceWildcardIterator(axis, ns); } } }
Example #13
Source File: SimpleResultTreeImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public DTMAxisIterator getAxisIterator(final int axis) { switch (axis) { case Axis.CHILD: case Axis.DESCENDANT: return new SimpleIterator(SimpleIterator.DIRECTION_DOWN); case Axis.PARENT: case Axis.ANCESTOR: return new SimpleIterator(SimpleIterator.DIRECTION_UP); case Axis.ANCESTORORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_UP)).includeSelf(); case Axis.DESCENDANTORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN)).includeSelf(); case Axis.SELF: return new SingletonIterator(); default: return EMPTY_ITERATOR; } }
Example #14
Source File: ChildTestIterator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); m_traverser = m_cdtm.getAxisTraverser(Axis.CHILD); // String localName = getLocalName(); // String namespace = getNamespace(); // int what = m_whatToShow; // // System.out.println("what: "); // // NodeTest.debugWhatToShow(what); // if(DTMFilter.SHOW_ALL == what || // ((DTMFilter.SHOW_ELEMENT & what) == 0) // || localName == NodeTest.WILD // || namespace == NodeTest.WILD) // { // m_extendedTypeID = 0; // } // else // { // int type = getNodeTypeTest(what); // m_extendedTypeID = m_cdtm.getExpandedTypeID(namespace, localName, type); // } }
Example #15
Source File: SAXImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Do not think that this returns an iterator for the namespace axis. * It returns an iterator with nodes that belong in a certain namespace, * such as with <xsl:apply-templates select="blob/foo:*"/> * The 'axis' specifies the axis for the base iterator from which the * nodes are taken, while 'ns' specifies the namespace URI type. */ public DTMAxisIterator getNamespaceAxisIterator(int axis, int ns) { if (ns == NO_TYPE) { return EMPTYITERATOR; } else { switch (axis) { case Axis.CHILD: return new NamespaceChildrenIterator(ns); case Axis.ATTRIBUTE: return new NamespaceAttributeIterator(ns); default: return new NamespaceWildcardIterator(axis, ns); } } }
Example #16
Source File: SAXImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Constructor NamespaceWildcard * * @param axis The axis that this iterator will traverse * @param nsType The namespace type index */ public NamespaceWildcardIterator(int axis, int nsType) { m_nsType = nsType; // Create a nested iterator that will select nodes of // the principal node kind for the selected axis. switch (axis) { case Axis.ATTRIBUTE: { // For "attribute::p:*", the principal node kind is // attribute m_baseIterator = getAxisIterator(axis); } case Axis.NAMESPACE: { // This covers "namespace::p:*". It is syntactically // correct, though it doesn't make much sense. m_baseIterator = getAxisIterator(axis); } default: { // In all other cases, the principal node kind is // element m_baseIterator = getTypedAxisIterator(axis, DTM.ELEMENT_NODE); } } }
Example #17
Source File: SimpleResultTreeImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
public DTMAxisIterator getAxisIterator(final int axis) { switch (axis) { case Axis.CHILD: case Axis.DESCENDANT: return new SimpleIterator(SimpleIterator.DIRECTION_DOWN); case Axis.PARENT: case Axis.ANCESTOR: return new SimpleIterator(SimpleIterator.DIRECTION_UP); case Axis.ANCESTORORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_UP)).includeSelf(); case Axis.DESCENDANTORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN)).includeSelf(); case Axis.SELF: return new SingletonIterator(); default: return EMPTY_ITERATOR; } }
Example #18
Source File: KeyIndex.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * <p>Given a context node and the second argument to the XSLT * <code>key</code> function, checks whether the context node is in the * set of nodes that results from that reference to the <code>key</code> * function. This is used in the implementation of key patterns.</p> * <p>This particular {@link KeyIndex} object is the result evaluating the * first argument to the <code>key</code> function, so it's not taken into * any further account.</p> * * @param node The context node * @param value The second argument to the <code>key</code> function * @return <code>1</code> if and only if the context node is in the set of * nodes returned by the reference to the <code>key</code> function; * <code>0</code>, otherwise */ public int containsKey(int node, Object value) { int rootHandle = _dom.getAxisIterator(Axis.ROOT) .setStartNode(node).next(); // Get the mapping table for the document containing the context node Map<String,IntegerArray> index = _rootToIndexMap.get(new Integer(rootHandle)); // Check whether the context node is present in the set of nodes // returned by the key function if (index != null) { final IntegerArray nodes = index.get(value); return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0; } // The particular key name identifies no nodes in this document return 0; }
Example #19
Source File: ChildTestIterator.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); m_traverser = m_cdtm.getAxisTraverser(Axis.CHILD); // String localName = getLocalName(); // String namespace = getNamespace(); // int what = m_whatToShow; // // System.out.println("what: "); // // NodeTest.debugWhatToShow(what); // if(DTMFilter.SHOW_ALL == what || // ((DTMFilter.SHOW_ELEMENT & what) == 0) // || localName == NodeTest.WILD // || namespace == NodeTest.WILD) // { // m_extendedTypeID = 0; // } // else // { // int type = getNodeTypeTest(what); // m_extendedTypeID = m_cdtm.getExpandedTypeID(namespace, localName, type); // } }
Example #20
Source File: SAXImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * This is a shortcut to the iterators that implement the * supported XPath axes (only namespace::) is not supported. * Returns a bare-bones iterator that must be initialized * with a start node (using iterator.setStartNode()). */ public DTMAxisIterator getAxisIterator(final int axis) { switch (axis) { case Axis.SELF: return new SingletonIterator(); case Axis.CHILD: return new ChildrenIterator(); case Axis.PARENT: return new ParentIterator(); case Axis.ANCESTOR: return new AncestorIterator(); case Axis.ANCESTORORSELF: return (new AncestorIterator()).includeSelf(); case Axis.ATTRIBUTE: return new AttributeIterator(); case Axis.DESCENDANT: return new DescendantIterator(); case Axis.DESCENDANTORSELF: return (new DescendantIterator()).includeSelf(); case Axis.FOLLOWING: return new FollowingIterator(); case Axis.PRECEDING: return new PrecedingIterator(); case Axis.FOLLOWINGSIBLING: return new FollowingSiblingIterator(); case Axis.PRECEDINGSIBLING: return new PrecedingSiblingIterator(); case Axis.NAMESPACE: return new NamespaceIterator(); case Axis.ROOT: return new RootIterator(); default: BasisLibrary.runTimeError(BasisLibrary.AXIS_SUPPORT_ERR, Axis.getNames(axis)); } return null; }
Example #21
Source File: XPathContext.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Create a new <code>DTMIterator</code> that holds exactly one node. * * @param node The node handle that the DTMIterator will iterate to. * * @return The newly created <code>DTMIterator</code>. */ public DTMIterator createDTMIterator(int node) { // DescendantIterator iter = new DescendantIterator(); DTMIterator iter = new com.sun.org.apache.xpath.internal.axes.OneStepIteratorForward(Axis.SELF); iter.setRoot(node, this); return iter; // return m_dtmManager.createDTMIterator(node); }
Example #22
Source File: WalkerFactory.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Tell if the given axis goes downword. Bogus name, if you can think of * a better one, please do tell. This really has to do with inverting * attribute axis. * @param axis One of Axis.XXX. * @return true if the axis is not a child axis and does not go up from * the axis root. */ public static boolean isDownwardAxisOfMany(int axis) { return ((Axis.DESCENDANTORSELF == axis) || (Axis.DESCENDANT == axis) || (Axis.FOLLOWING == axis) // || (Axis.FOLLOWINGSIBLING == axis) || (Axis.PRECEDING == axis) // || (Axis.PRECEDINGSIBLING == axis) ); }
Example #23
Source File: SAXImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * This is a shortcut to the iterators that implement the * supported XPath axes (only namespace::) is not supported. * Returns a bare-bones iterator that must be initialized * with a start node (using iterator.setStartNode()). */ public DTMAxisIterator getAxisIterator(final int axis) { switch (axis) { case Axis.SELF: return new SingletonIterator(); case Axis.CHILD: return new ChildrenIterator(); case Axis.PARENT: return new ParentIterator(); case Axis.ANCESTOR: return new AncestorIterator(); case Axis.ANCESTORORSELF: return (new AncestorIterator()).includeSelf(); case Axis.ATTRIBUTE: return new AttributeIterator(); case Axis.DESCENDANT: return new DescendantIterator(); case Axis.DESCENDANTORSELF: return (new DescendantIterator()).includeSelf(); case Axis.FOLLOWING: return new FollowingIterator(); case Axis.PRECEDING: return new PrecedingIterator(); case Axis.FOLLOWINGSIBLING: return new FollowingSiblingIterator(); case Axis.PRECEDINGSIBLING: return new PrecedingSiblingIterator(); case Axis.NAMESPACE: return new NamespaceIterator(); case Axis.ROOT: return new RootIterator(); default: BasisLibrary.runTimeError(BasisLibrary.AXIS_SUPPORT_ERR, Axis.getNames(axis)); } return null; }
Example #24
Source File: WalkerFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Tell if the given axis goes downword. Bogus name, if you can think of * a better one, please do tell. This really has to do with inverting * attribute axis. * @param axis One of Axis.XXX. * @return true if the axis is not a child axis and does not go up from * the axis root. */ public static boolean isDownwardAxisOfMany(int axis) { return ((Axis.DESCENDANTORSELF == axis) || (Axis.DESCENDANT == axis) || (Axis.FOLLOWING == axis) // || (Axis.FOLLOWINGSIBLING == axis) || (Axis.PRECEDING == axis) // || (Axis.PRECEDINGSIBLING == axis) ); }
Example #25
Source File: KeyIndex.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Given a context node and the argument to the XPath <code>id</code> * function, checks whether the context node is in the set of nodes that * results from that reference to the <code>id</code> function. This is * used in the implementation of <code>id</code> patterns. * * @param node The context node * @param value The argument to the <code>id</code> function * @return <code>1</code> if the context node is in the set of nodes * returned by the reference to the <code>id</code> function; * <code>0</code>, otherwise */ public int containsID(int node, Object value) { final String string = (String)value; int rootHandle = _dom.getAxisIterator(Axis.ROOT) .setStartNode(node).next(); // Get the mapping table for the document containing the context node Map<String, IntegerArray> index = _rootToIndexMap.get(rootHandle); // Split argument to id function into XML whitespace separated tokens final StringTokenizer values = new StringTokenizer(string, " \n\t"); while (values.hasMoreElements()) { final String token = (String) values.nextElement(); IntegerArray nodes = null; if (index != null) { nodes = index.get(token); } // If input was from W3C DOM, use DOM's getElementById to do // the look-up. if (nodes == null && _enhancedDOM != null && _enhancedDOM.hasDOMSource()) { nodes = getDOMNodeById(token); } // Did we find the context node in the set of nodes? if (nodes != null && nodes.indexOf(node) >= 0) { return 1; } } // Didn't find the context node in the set of nodes returned by id return 0; }
Example #26
Source File: DescendantIterator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Create a DescendantIterator object. * */ public DescendantIterator() { super(null); m_axis = Axis.DESCENDANTSORSELFFROMROOT; int whatToShow = DTMFilter.SHOW_ALL; initNodeTest(whatToShow); }
Example #27
Source File: SingleNodeCounter.java From JDKSourceCode1.8 with MIT License | 5 votes |
public NodeCounter setStartNode(int node) { _node = node; _nodeType = _document.getExpandedTypeID(node); _countSiblings = _document.getTypedAxisIterator(Axis.PRECEDINGSIBLING, _document.getExpandedTypeID(node)); return this; }
Example #28
Source File: Step.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns a string representation of this step. */ public String toString() { final StringBuffer buffer = new StringBuffer("step(\""); buffer.append(Axis.getNames(_axis)).append("\", ").append(_nodeType); if (_predicates != null) { final int n = _predicates.size(); for (int i = 0; i < n; i++) { final Predicate pred = (Predicate)_predicates.elementAt(i); buffer.append(", ").append(pred.toString()); } } return buffer.append(')').toString(); }
Example #29
Source File: SingleNodeCounter.java From Bytecoder with Apache License 2.0 | 5 votes |
public NodeCounter setStartNode(int node) { _node = node; _nodeType = _document.getExpandedTypeID(node); _countSiblings = _document.getTypedAxisIterator(Axis.PRECEDINGSIBLING, _document.getExpandedTypeID(node)); return this; }
Example #30
Source File: KeyIndex.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Given a context node and the argument to the XPath <code>id</code> * function, checks whether the context node is in the set of nodes that * results from that reference to the <code>id</code> function. This is * used in the implementation of <code>id</code> patterns. * * @param node The context node * @param value The argument to the <code>id</code> function * @return <code>1</code> if the context node is in the set of nodes * returned by the reference to the <code>id</code> function; * <code>0</code>, otherwise */ public int containsID(int node, Object value) { final String string = (String)value; int rootHandle = _dom.getAxisIterator(Axis.ROOT) .setStartNode(node).next(); // Get the mapping table for the document containing the context node Map<String, IntegerArray> index = _rootToIndexMap.get(rootHandle); // Split argument to id function into XML whitespace separated tokens final StringTokenizer values = new StringTokenizer(string, " \n\t"); while (values.hasMoreElements()) { final String token = (String) values.nextElement(); IntegerArray nodes = null; if (index != null) { nodes = index.get(token); } // If input was from W3C DOM, use DOM's getElementById to do // the look-up. if (nodes == null && _enhancedDOM != null && _enhancedDOM.hasDOMSource()) { nodes = getDOMNodeById(token); } // Did we find the context node in the set of nodes? if (nodes != null && nodes.indexOf(node) >= 0) { return 1; } } // Didn't find the context node in the set of nodes returned by id return 0; }