[jdom-interest] XPath bindings?

Elliotte Rusty Harold elharo at metalab.unc.edu
Sun Oct 28 05:27:21 PST 2001


At 1:46 PM -0500 10/13/01, philip.nelson at omniresources.com wrote:

>Not completely.  It would seem kind of silly to have an xpath statement with
>[position()=1] and then have to retrieve it from a list anyway.
>
>Element theNode = (Element)(selectNodes("/some/xpath[position()=1]").get(1))
>
>compared to 
>
>Element theNode = (Element) selectSingleNode("/some/xpath[position()=1]")
>

I still don't like this, but if we're going to do it I suggest that the method be called selectFirstNode() rather than selectSingleNode(). It's a little more descriptive, and no harder to type. 
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+ 
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/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.ibiblio.org/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list