JDOM2 Feature Text Coalesce
Clone this wiki locally
In JDOM you could potentially end up with multiple consecutive Text items in your Element content. This will seldom happen because typically this can only be done programmatically. JDOM will always coalesce the character data coming from parsers, so, in essence you would have to manually add consecutive Text content, or remove some other content that previously separated Text content, etc. in order to get in to this condition.
There is nothing technically wrong with consecutive Text content, but it can sometimes be challenging to process. The DOM XML Model has the
Node.normalize() method to identify and remove these conditions. JDOM 2.0.0 introduces the
Element.coalesceText(boolean) method which does essentially the same thing. It joins adjacent Text content and removes any empty-String content. The
coalesceText(boolean) method will perform the operation on itself and all child elements recursively if given a
true parameter, and only itself if given a