Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

Re: [jdom-interest] Last call: getChild/getChildren versus getChildElement/getChildElements

Jason Hunter

2004-02-05

Replies:

Elliotte Rusty Harold wrote:

> At 3:11 PM -0800 2/5/04, Jason Hunter wrote:
>
>> And here's more ammo. What does $foo/child::* return in XPath/XQuery?
>> All the child elements! So getChildren() makes perfect sense in that
>> view.
>
> but $foo/child::node() returns all nodes, not just elements. The
> elements part of this expression is in the *, not the child.

Yes, but the child axis still has elements as the principal node type,
which is why $foo/child::bar returns bar elements and not bar PIs. Thus
getChildren("bar") can be justified to return bar elements.

> getChildElements is the right name for a method that does not return all
> children.

If we were starting over, I think I'd agree with you. But I don't want
the hate mail. I'd rather have Vadim's beer. :-)

-jh-

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.