You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Norris Boyd <nb...@atg.com> on 2001/02/23 22:35:59 UTC
[Xalan-J 2 BUG] ClassCastException in XPathAPI.selectNodeList
Problem:
java.lang.ClassCastException:
org.apache.xpath.axes.UnionPathIterator
java.lang.ClassCastException: org.apache.xpath.axes.UnionPathIterator at
org.apache.xpath.XPathAPI.selectNodeList(XPathAPI.java:201)
This is fixed by the following change:
--- XPathAPI.java.old Fri Feb 23 16:14:59 2001
+++ XPathAPI.java Fri Feb 23 16:21:17 2001
@@ -198,7 +198,14 @@
XObject list = eval(contextNode, str, namespaceNode);
// Have the XObject return its result as a NodeSet.
- return (NodeList) list.nodeset();
+ NodeSet nodeset = list.mutableNodeset();
+
+ // setShouldCacheNodes(true) be called before the first nextNode()
is
+ // called, in order that nodes can be added as they are fetched.
+ nodeset.setShouldCacheNodes(true);
+
+ // Return a NodeList.
+ return (NodeList) nodeset;
}
I added the setShouldCacheNodes call after reading the javadoc for
NodeSet.
Thanks,
Norris Boyd