[jdom-interest] org.jdom.xpath.XPath

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Apr 10 09:51:51 PDT 2002


At 2:04 PM +0200 4/10/02, Laurent Bihanic wrote:


>More specifically, valueOf() currently returns an empty string if 
>the XPath expression does not match any node. Thus, valueOf() for 
>the XPath expression "@name" will return "" if the attribute "name" 
>is missing or if it's actual value is "".
>The method numberValueOf() already distinguishes the two cases 
>returning either null (no match) or Double.NaN (found value cannot 
>be converted into a number).
>

I don't think XPath 1.0 defines the value of a node set. However, 
using the string() function

A node-set is converted to a string by returning the string-value of 
the node in the node-set that is first in document order. If the 
node-set is empty, an empty string is returned.

Thus Jaxen seems to be correct in this case.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|             http://www.cafeconleche.org/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list