[jdom-interest] get number of children
jools at jools.org
Wed Jan 17 06:58:42 PST 2001
> how can i know the number of children in an element or in the root.
> (without using getChildren as list, then use list.size())
I'm afraid that's the only way you can find out how many children are in
> and can i reference an element by it's index/number without giving the name:
> something like elem.getchild(0) will bring me the first child in the elem
getChildren() returns a List. The List interface has a method called
which you can use if you need random access to the list. However if you
wish to iterate through the list, an Iterator is more efficient.
The Element itself does not provide this functionality.
More information about the jdom-interest