You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Chris Picton <ch...@tangent.co.za> on 2005/07/26 10:24:15 UTC
jxpath NullPointerException
Hi all
I am trying to get a Pointer to the last node in a set of nodes, using
the following xpath:
//item[@mutable='1'][last()]
I get the following exception thrown:
---------------
Exception in thread "main" java.lang.NullPointerException
at
org.apache.commons.jxpath.ri.model.dom.DOMNodeIterator.next(DOMNodeIterator.java:117)
at
org.apache.commons.jxpath.ri.model.dom.DOMNodeIterator.setPosition(DOMNodeIterator.java:68)
at
org.apache.commons.jxpath.ri.axes.ChildContext.setPosition(ChildContext.java:106)
at
org.apache.commons.jxpath.ri.axes.ChildContext.nextNode(ChildContext.java:89)
at
org.apache.commons.jxpath.ri.axes.PredicateContext.nextNode(PredicateContext.java:53)
at
org.apache.commons.jxpath.ri.axes.PredicateContext.setPositionStandard(PredicateContext.java:181)
at
org.apache.commons.jxpath.ri.axes.PredicateContext.setPosition(PredicateContext.java:134)
at
org.apache.commons.jxpath.ri.compiler.CoreFunction.functionLast(CoreFunction.java:289)
at
org.apache.commons.jxpath.ri.compiler.CoreFunction.computeValue(CoreFunction.java:213)
at
org.apache.commons.jxpath.ri.axes.PredicateContext.nextNode(PredicateContext.java:81)
at
org.apache.commons.jxpath.ri.EvalContext.getSingleNodePointer(EvalContext.java:296)
at
org.apache.commons.jxpath.ri.compiler.Path.searchForPath(Path.java:183)
at
org.apache.commons.jxpath.ri.compiler.Path.getSingleNodePointerForSteps(Path.java:159)
at
org.apache.commons.jxpath.ri.compiler.LocationPath.computeValue(LocationPath.java:82)
at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getPointer(JXPathContextReferenceImpl.java:400)
at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getPointer(JXPathContextReferenceImpl.java:396)
at test.main(test.java:19)
--------------------
I have attached my test.java and instance.xml for perusal.
If anyone can tell me why my code is failing, I would appreciate it.
Regards
Chris