Hi Jim

----- Original Message -----
From: "Brain, Jim" <[EMAIL PROTECTED]>
> I think the current way is better:
>
> If the javadoc was right, code to work on nodes found would be:
>
> Object o=doc.selectObject(//something);
> If(o instanceof Node) {
>  Big chunk of code to work on Nodes
> } Else if (o instanceof List) {
>  Same big bunch of code, with a for loop around it.
> }...
>
> However, if people normally only get a single Node, the List idea forces
the
> extra loop even when you know you'll get 1 return, which might be a bit
> slower.
>
> I really don't care, just would like the code to match the javadoc, so I
> thought I would bring it up.

Thanks Jim. I've patched the Javadoc to reflect the current behaviour. If
one or more Nodes are matched by the XPath then a List of Nodes is returned;
otherwise a scalar value is returned like a String or Number.

If a user knows they want to select a single Node only then they can use the
selectSingleNode() method.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to