> NodeList result = (NodeList) xpath.evaluate(expression, (Object) null, XPathConstants.NODESET);

Signature
Martin Honnen
http://JavaScript.FAQTs.com/
Hi Martin!
>> NodeList result = (NodeList) xpath.evaluate(expression,
>> (Object) null, XPathConstants.NODESET);
>
> Have you tried passing in an object like that document you have as the
> second argument, and not null like you do?
Well, I have now -- and it works!! So I'm grateful for you help!
However it is supposed to work with "null" according to the interface
description:
"If a null value is provided for item, an empty document will be used
for the context."*
But it works even if the document passed is an newly created (empty) one
-- so it will do.
Thank you for your help!
--tim
* see
http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/xpath/XPath.html#evaluate(java
.lang.String,%20java.lang.Object,%20javax.xml.namespace.QName)
Martin Honnen - 26 Sep 2006 18:42 GMT
> However it is supposed to work with "null" according to the interface
> description:
>
> "If a null value is provided for item, an empty document will be used
> for the context."*
You might want to file a bug on that with Sun, they either need to
change the documentation or fix the code.

Signature
Martin Honnen
http://JavaScript.FAQTs.com/
Tim Hallwyl - 27 Sep 2006 18:22 GMT
> You might want to file a bug on that with Sun, they either need to
> change the documentation or fix the code.
Ah, yes -- I found that is was already filed as a bug (id 6211561). Next
time I might take a look at the bug database first (however I did not
suspect it to be a bug at first, rather that I was missing out on some
thing -- but it is a bug)