[jdom-interest] Merging text nodes
bob at werken.com
Tue Feb 19 10:09:39 PST 2002
On Tue, 19 Feb 2002, Dennis Sosnoski wrote:
> I agree with Alex that the auto-magical text merging behavior can create
> problems. Why not use a normalize()-type method to handle this (which
> could even be in a support class, rather than in the core classes)? That
> way the code complexity is reduced and there's no overhead for checking
> possible merges unless the user actually makes the request.
I agree whole-heartedly with this recommendation.
If anything is done dynamically, on-the-fly, then programatically
constructed documents may undergo an 'optimization' run after
each modification. I think it's best to externalize this functionality,
and let the developer decide when/if this should be done.
Possibly, add a switch to the FooBuilders (or make it default) to
use the normalization after the document is built.
Any sort of piece-wise normalization will cause fits, and it'll
be difficult to know when document construction is 'done' without
the aide of the developer building the document.
More information about the jdom-interest