[jdom-interest] Merging text nodes

Bradley S. Huffman hip at a.cs.okstate.edu
Tue Feb 19 08:55:47 PST 2002


Alex Rosen writes:

> I think this might be a problem... suppose you were iterating over the
> children, adding or removing nodes? Presumably set() and remove() would also
> merge newly-adjacent text nodes, which could cause the following (weird, but
> legal) code to fail:

Or just iterating over the content in general, take the sequence Text, Element,
Text.  If during the interation you do a remove() on Element, what does
previous() and next() return? The Text node before Element, the two Text nodes
merged.  The more I think of it, anymore automatic merging not might not be
such a good idea.

Brad



More information about the jdom-interest mailing list