[jdom-interest] API Inertia
jhunter at acm.org
Mon Apr 30 23:09:29 PDT 2001
Elliotte Rusty Harold wrote:
> I think it would help because the Node interface would have
> hasChildren() and getChildren() methods. These would be applicable to
> all nodes.
All nodes except: Attribute, DocType, Entity, CDATA.
Or are you saying that hasChildren() will just return false for nodes
which could *never* have children. That's not very appealing, to have a
getChildren() method on an object which can't have children.
> This lets you
> walk the tree without caring excessively about the type of each node
> in the tree or without a lot of casting.
No casting so long as you don't really want to *do* anything with a
> Frankly I'm amazed that Jason seems worried about typing an
> occasional few lines of extra code in the rare case that he needs to
> move an element, as evidenced in the detach() thread,
That's putting a burden on the JDOM user. I want to avoid that.
> while being
> completely unfazed by the huge number of lines doing nothing but
> casting and type checking that permeate the JDOM code base today.
That's putting a burden on the JDOM library implementation. That's
fine, if it helps the user.
> Both positions are reasonable and well argued by Jason. I just don't
> see how he can fit both of them into the same brain at the same time.
> Everything's a node. By default you visit everything except
> attributes (which aren't children) but we can put filters in the
> utilities package.
Interesting, while some have everything but Document as a Node you have
everything but Attribute. :-)
> I think we should resolve all entities at build time, and then forget
> about them. This requires the use of a validating parser, which is
> not a big problem. It does not require us to validate, merely to read
> the external DTD subset, which is not a big deal.
That's mostly the plan we have in place, although we'll have the
non-default option for someone not to expand entities and use
EntityRef's. It's a big performance win, 50x in my testing of a
smallish config file.
More information about the jdom-interest