[jdom-interest] Merging text nodes

Elliotte Rusty Harold elharo at metalab.unc.edu
Sat Feb 16 13:55:43 PST 2002


DOM3 is beginning to add methods to *normalize* documents and 
elements. In brief this means that all CDATA section nodes are 
converted to text nodes and all adjacent text nodes are combined. 
Thus each text node contains the maximum possible contiguous run of 
text.

In JDOM we are mostly doing this automatically. That is, the Element 
class notices if one Text node is added immediately after another and 
if so merges them. However, there are a few holes in the process. For 
instance, if two text nodes are separated by an Element node which is 
then deleted, the newly adjacent text nodes are not merged. Is this 
something that's worth fixing?
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list