[jdom-interest] getChildren() vs getElements()
Brett McLaughlin
brett.mclaughlin at lutris.com
Fri Sep 15 20:39:35 PDT 2000
Jason Hunter wrote:
>
> > getElements() is not ambiguous. It doesn't imply that it recurses any
> > more than getChildren() implies that it recurses. Once you accept
> > that an element can contain elements, it is not confusing (it only
> > sounds self-referential, but it's not).
>
> But element.getElement() -- the singular form -- does look way too
> self-referential.
>
> > getChildText(String name) is a convenience method anyway, but what
> > would be the problem with renaming it getText(String name) ? The
> > presence of the parameter should clear up any ambiguity.
>
> As much as I love the use of such a method, that's just awful. You
> don't change from parent text to child text retrieval based on a
> parameter.
>
> > Or not :-)
>
> Yeah, I choose that one. :-)
>
> I like getChild() and getChildren() because it has a certain panache.
> Matches nicely with getParent(). Easy to tell them apart. Nice and
> short. That naming makes me happy in a Zen sort of way.
Now, if it was only correct. But it isn't, and a cursory reading of any
XML specification makes it confusing, especially getChildren(), which no
amount of "looking at the return value" can solve. I admit that
getChildren() is easier - you should at least be willing to admit that
it's semantically incorrect with respect to XML ;-) Let's be fair here.
-Brett
>
> -jh-
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
--
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc.
1200 Pacific Avenue, Suite 300
Santa Cruz, CA 95060 USA
http://www.lutris.com
http://www.enhydra.org
More information about the jdom-interest
mailing list