286N/A * reserved comment block 286N/A * DO NOT REMOVE OR ALTER! 286N/A * Copyright 1999-2004 The Apache Software Foundation. 286N/A * Licensed under the Apache License, Version 2.0 (the "License"); 286N/A * you may not use this file except in compliance with the License. 286N/A * You may obtain a copy of the License at 286N/A * Unless required by applicable law or agreed to in writing, software 286N/A * distributed under the License is distributed on an "AS IS" BASIS, 286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 286N/A * See the License for the specific language governing permissions and 286N/A * limitations under the License. 286N/A * This class represents an XPath nodeset object, and is capable of 286N/A * converting the nodeset to other types, such as a string. 286N/A * Default constructor for derived objects. 286N/A * Construct a XNodeSet object. 286N/A * @param val Value of the XNodeSet object 286N/A // First make sure the DTMIterator val has a cache, 286N/A // so if it doesn't have one, make one. 286N/A // Get the cache from val and use it ourselves (we share it). 286N/A * Construct a XNodeSet object. 286N/A * @param val Value of the XNodeSet object 286N/A * Construct an empty XNodeSet object. This is used to create a mutable 286N/A * nodeset to which random nodes may be added. 286N/A * Construct a XNodeSet object for one node. 286N/A * @param n Node to add to the new XNodeSet object 286N/A * Tell that this is a CLASS_NODESET. 286N/A * @return type CLASS_NODESET 286N/A * Given a request type, return the equivalent string. 286N/A * For diagnostic purposes. 286N/A * @return type string "#NODESET" 286N/A * Get numeric value of the string conversion from a single node. 286N/A * @param n Node to convert 286N/A * @return numeric value of the string conversion from a single node. 286N/A * Cast result object to a number. 286N/A * @return numeric value of the string conversion from the 286N/A * next node in the NodeSetDTM, or NAN if no node was found 286N/A * Cast result object to a number, but allow side effects, such as the 286N/A * incrementing of an iterator. 286N/A * @return numeric value of the string conversion from the 286N/A * next node in the NodeSetDTM, or NAN if no node was found 286N/A * Cast result object to a boolean. 286N/A * @return True if there is a next node in the nodeset 286N/A * Cast result object to a boolean, but allow side effects, such as the 286N/A * incrementing of an iterator. 286N/A * @return True if there is a next node in the nodeset 286N/A * Get the string conversion from a single node. 286N/A * @param n Node to convert 286N/A * @return the string conversion from a single node. 286N/A // I guess we'll have to get a static instance of the DTM manager... 286N/A * characters method on the passed ContentHandler for the 286N/A * string-value. Multiple calls to the 286N/A * ContentHandler's characters methods may well occur for a single call to 286N/A * @param ch A non-null reference to a ContentHandler. 286N/A * @throws org.xml.sax.SAXException 286N/A * Cast result object to an XMLString. 286N/A * @return The document fragment node data or the empty string. 286N/A * Cast result object to a string. 286N/A * @return The string this wraps or the empty string if null 286N/A * Cast result object to a string. 286N/A * @return the string conversion from the next node in the nodeset 286N/A * or "" if there is no next node 286N/A * Return a java object that's closest to the representation 286N/A * that should be handed to an extension. 286N/A * @return The object that this class wraps 286N/A// * Cast result object to a result tree fragment. 286N/A// * @param support The XPath context to use for the conversion 286N/A// * @return the nodeset as a result tree fragment. 286N/A// public DocumentFragment rtree(XPathContext support) 286N/A// DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 286N/A// DocumentBuilder db = dbf.newDocumentBuilder(); 286N/A// Document myDoc = db.newDocument(); 286N/A// DocumentFragment docFrag = myDoc.createDocumentFragment(); 286N/A// DTMIterator nl = iter(); 286N/A// while (DTM.NULL != (node = nl.nextNode())) 286N/A// frag.appendChild(node, true, true); 286N/A// return frag.getDocument(); 286N/A * Cast result object to a nodelist. 286N/A * @return a NodeIterator. 286N/A * @throws javax.xml.transform.TransformerException 286N/A * Cast result object to a nodelist. 286N/A * @throws javax.xml.transform.TransformerException 286N/A // Creating a DTMNodeList has the side-effect that it will create a clone 286N/A // XNodeSet with cache and run m_iter to the end. You cannot get any node 286N/A // from m_iter after this call. As a fix, we call SetVector() on the clone's 286N/A // cache. See Bugzilla 14406. 286N/A// * Return a java object that's closest to the representation 286N/A// * that should be handed to an extension. 286N/A// * @return The object that this class wraps 286N/A// public Object object() 286N/A * Return the iterator without cloning, etc. 286N/A * Cast result object to a nodelist. 286N/A * @return The nodeset as a nodelist 286N/A return this;
// don't bother to clone... won't do any good! 286N/A * Get a fresh copy of the object. For use with variables. 286N/A * @return A fresh nodelist. 286N/A return this;
// don't bother to clone... won't do any good! 286N/A * Cast result object to a mutableNodeset. 286N/A * @return The nodeset as a mutableNodeset 286N/A /** Less than comparator */ 286N/A /** Less than or equal comparator */ 286N/A /** Greater than comparator */ 286N/A /** Greater than or equal comparator */ 286N/A /** Equal comparator */ 286N/A /** Not equal comparator */ 286N/A * Tell if one object is less than the other. 286N/A * @param obj2 Object to compare this nodeset to 286N/A * @param comparator Comparator to use 286N/A * @return See the comments below for each object type comparison 286N/A * @throws javax.xml.transform.TransformerException 286N/A // %OPT% This should be XMLString based instead of string based... 286N/A // If both objects to be compared are node-sets, then the comparison 286N/A // will be true if and only if there is a node in the first node-set 286N/A // and a node in the second node-set such that the result of performing 286N/A // the comparison on the string-values of the two nodes is true. 286N/A // Note this little gem from the draft: 286N/A // NOTE: If $x is bound to a node-set, then $x="foo" 286N/A // does not mean the same as not($x!="foo"): the former 286N/A // is true if and only if some node in $x has the string-value 286N/A // foo; the latter is true if and only if all nodes in $x have 286N/A // the string-value foo. 286N/A for (
int i =
0; i < n; i++)
286N/A // If one object to be compared is a node-set and the other is a boolean, 286N/A // then the comparison will be true if and only if the result of 286N/A // performing the comparison on the boolean and on the result of 286N/A // converting the node-set to a boolean using the boolean function 286N/A // If one object to be compared is a node-set and the other is a number, 286N/A // then the comparison will be true if and only if there is a 286N/A // node in the node-set such that the result of performing the 286N/A // comparison on the number to be compared and on the result of 286N/A // converting the string-value of that node to a number using 286N/A // the number function is true. 286N/A // If one object to be compared is a node-set and the other is a 286N/A // string, then the comparison will be true if and only if there 286N/A // is a node in the node-set such that the result of performing 286N/A // the comparison on the string-value of the node and the other 286N/A * Tell if one object is less than the other. 286N/A * @param obj2 object to compare this nodeset to 286N/A * @return see this.compare(...) 286N/A * @throws javax.xml.transform.TransformerException 286N/A * Tell if one object is less than or equal to the other. 286N/A * @param obj2 object to compare this nodeset to 286N/A * @return see this.compare(...) 286N/A * @throws javax.xml.transform.TransformerException 286N/A * Tell if one object is less than the other. 286N/A * @param obj2 object to compare this nodeset to 286N/A * @return see this.compare(...) 286N/A * @throws javax.xml.transform.TransformerException 286N/A * Tell if one object is less than the other. 286N/A * @param obj2 object to compare this nodeset to 286N/A * @return see this.compare(...) 286N/A * @throws javax.xml.transform.TransformerException 286N/A * Tell if two objects are functionally equal. 286N/A * @param obj2 object to compare this nodeset to 286N/A * @return see this.compare(...) 286N/A * @throws javax.xml.transform.TransformerException 286N/A * Tell if two objects are functionally not equal. 286N/A * @param obj2 object to compare this nodeset to 286N/A * @return see this.compare(...) 286N/A * @throws javax.xml.transform.TransformerException 286N/A * compares nodes for various boolean operations. 286N/A * @param s1 First string to compare 286N/A * @param s2 Second String to compare 286N/A * @return Whether the strings are equal or not 286N/A * @param n1 First number to compare 286N/A * @param n2 Second number to compare 286N/A * @return Whether the numbers are equal or not 286N/A * Compare strings or numbers for less than. 286N/A * Compare two strings for less than. 286N/A * @param s1 First string to compare 286N/A * @param s2 Second String to compare 286N/A * @return True if s1 is less than s2 286N/A // return s1.compareTo(s2) < 0; 286N/A * Compare two numbers for less than. 286N/A * @param n1 First number to compare 286N/A * @param n2 Second number to compare 286N/A * @return true if n1 is less than n2 286N/A * Compare strings or numbers for less than or equal. 286N/A * Compare two strings for less than or equal. 286N/A * @param s1 First string to compare 286N/A * @param s2 Second String to compare 286N/A * @return true if s1 is less than or equal to s2 286N/A // return s1.compareTo(s2) <= 0; 286N/A * Compare two numbers for less than or equal. 286N/A * @param n1 First number to compare 286N/A * @param n2 Second number to compare 286N/A * @return true if n1 is less than or equal to n2 286N/A * Compare strings or numbers for greater than. 286N/A * Compare two strings for greater than. 286N/A * @param s1 First string to compare 286N/A * @param s2 Second String to compare 286N/A * @return true if s1 is greater than s2 286N/A // return s1.compareTo(s2) > 0; 286N/A * Compare two numbers for greater than. 286N/A * @param n1 First number to compare 286N/A * @param n2 Second number to compare 286N/A * @return true if n1 is greater than n2 286N/A * Compare strings or numbers for greater than or equal. 286N/A * Compare two strings for greater than or equal. 286N/A * @param s1 First string to compare 286N/A * @param s2 Second String to compare 286N/A * @return true if s1 is greater than or equal to s2 286N/A // return s1.compareTo(s2) >= 0; 286N/A * Compare two numbers for greater than or equal. 286N/A * @param n1 First number to compare 286N/A * @param n2 Second number to compare 286N/A * @return true if n1 is greater than or equal to n2 286N/A * Compare strings or numbers for equality. 286N/A * Compare two strings for equality. 286N/A * @param s1 First string to compare 286N/A * @param s2 Second String to compare 286N/A * @return true if s1 is equal to s2 286N/A * Compare two numbers for equality. 286N/A * @param n1 First number to compare 286N/A * @param n2 Second number to compare 286N/A * @return true if n1 is equal to n2 286N/A * Compare strings or numbers for non-equality. 286N/A * Compare two strings for non-equality. 286N/A * @param s1 First string to compare 286N/A * @param s2 Second String to compare 286N/A * @return true if s1 is not equal to s2 286N/A * Compare two numbers for non-equality. 286N/A * @param n1 First number to compare 286N/A * @param n2 Second number to compare 286N/A * @return true if n1 is not equal to n2