[jdom-interest] XPath selectSingleNode returns Boolean problem

Jason Hunter jhunter at servlets.com
Thu Feb 5 11:07:44 PST 2004


Done.  I didn't realize Jaxen was supporting that underneath.  Makes me 
wonder if it shouldn't be selectSingleItem() rather than selectSingleNode().

-jh-

Bradley S. Huffman wrote:

> IMO change the javadocs to inform/warn that the results of a query may
> contain more that just JDOM objects.
> 
> Brad
> 
> Jason Hunter writes:
> 
> 
>>I never saw a response on this.  Laurent, what was your original plan 
>>for handling things like this?
>>
>>-jh-
>>
>>Steven Shand wrote:
>>
>>
>>>The javadocs state that XPath.selectSingleNode can return node types 
>>>only (Element ,Attribute ,Text ,CDATA ,Comment or ProcessingInstruction)
>>>
>>>However the code below return a Boolean.
>>>
>>>String expression = "descendant-or-self::text() != ''"
>>>XPath xpath = XPath.newInstance( expression );
>>>Object match = xpath.selectSingleNode( element );
>>>
>>>I guess this is a bug or am I missing something obvious?
>>>
>>>Ironically, this behavior is just what I want!
> 
> 



More information about the jdom-interest mailing list