Dmitri,
I've downloaded the latest sources (10-Nov-2002), but still the same
problems. I've solved my problem for now, but I have insufficient
knowledge of the design JXPath internals:
In JXPathContextReferenceImpl I changed this:
public Object getValue(String xpath, Expression expr){
Object result = expr.computeValue(getRootContext());
if (result == null && !lenient){
throw new JXPathException("No value for xpath: " + xpath);
}
if (result instanceof EvalContext){
EvalContext ctx = (EvalContext)result;
result = ctx.getSingleNodePointer();
}
if (result instanceof NodePointer){
result = ((NodePointer)result).getValue();
}
// addition by Ruud Diterwich allows variables containing
DOMNodePointers
if (result instanceof NodePointer){
result = ((NodePointer)result).getValue();
}
return result;
}
This way, returning DOMNodePointers from Variables.getVariable would do
the trick. However, some of my test cases result in an infinite loop.
The other thing I tried is to add a line to
BasicTypeConverter.convert(object, toType):
if (object instanceof Node && toType == String.class) {
return new DOMNodePointer((Node) object,
Locale.getDefault()).getValue().toString();
}
Now, Variable.getVariable should return a straight DOM node. This works
for me, but seems a bit of a hack. I've no idea what to do with the
locale parameter either...
Hope this helps a bit.
Regards,
Ruud Diterwich
--
To unsubscribe, e-mail: <mailto:commons-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-user-help@;jakarta.apache.org>