Title: Variable null values and DOM navigator

I am using the DOM navigator and a custom VariableContext implementation.

When I evaluate XPaths, that apply sub paths to Variables whose value is null (I believe from the documentation for VariableContext that this is valid?) I get a NullPointer from the DOM navigator:

java.lang.NullPointerException
 at org.jaxen.dom.DocumentNavigator$1.getFirstNode (DocumentNavigator.java:175)
 at org.jaxen.dom.DocumentNavigator$NodeIterator.<init> (DocumentNavigator.java:823)
 at org.jaxen.dom.DocumentNavigator$1.<init>(DocumentNavigator.java:172)
 at org.jaxen.dom.DocumentNavigator.getChildAxisIterator (DocumentNavigator.java:172)
 at org.jaxen.expr.iter.IterableChildAxis.iterator (IterableChildAxis.java:82)
 at org.jaxen.expr.DefaultStep.axisIterator(DefaultStep.java:139)
 at org.jaxen.expr.DefaultLocationPath.evaluate (DefaultLocationPath.java:188)
 at org.jaxen.expr.DefaultPathExpr.evaluate(DefaultPathExpr.java:156)
 at org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:107)
 at org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:716)
 at org.jaxen.BaseXPath.selectNodes(BaseXPath.java:239)
 at fbsl.actions.jaxen.JaxenXPathEngine.executeExpression

the expressions are of the form $V/X

should the navigator be checking the contextNode for null and returning null for getFirstNode() and getNextNode()?

This would appear to be neccesary on each of the axis Iterators:
        getChildAxisIterator
        getParentAxisIterator
        ...

should I not use null values for empty variables? instead using an empty List? This would be a pity as being able to tell the null case from the empty case is potentially useful.

Any help appreciated

Ian

Reply via email to