[jdom-interest] XPath selectSingleNode returns Boolean problem

Bradley S. Huffman hip at cs.okstate.edu
Thu Feb 5 07:46:34 PST 2004


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