[jdom-interest] Children

bob mcwhirter bob at werken.com
Tue May 1 11:13:03 PDT 2001

Stepped out for a cup of coffee, and had a thought regarding
Node.getChildren() and Node.hasChildren().

Element.getChildren() shouldn't return Namespaces or Attributes.  The W3C
specs say that Attributes and Namespaces have parents which are Element,
but they are not Children of
that Element.

Specifically, in the context of XPath, the child:: axis does *not*
include Attributes and Namespaces.

So, if getChildren() returned all nodes under the present one,
it would possibly be confusing to folks who've actually read
the specifications.

Iff we do end up with Node interface, with some generic way to
find Nodes further on down the tree, I'd fight heartily to *not*
call it getChildren() or hasChildren(), for the reasons noted above.

Though, I still don't personally recognize a need for a Node interface,
especially if a Visitor type of thing were implemented instead, to allow
traversal.  Or maybe an Iterator pattern of some flavor.  


More information about the jdom-interest mailing list