[jdom-interest] Merging text nodes

Elliotte Rusty Harold elharo at metalab.unc.edu
Sun Feb 17 13:44:13 PST 2002


At 3:36 PM -0600 2/17/02, Bradley S. Huffman wrote:


>Let me restate that, should there be a additional method that does parse
>entities?  Would something like
>
>         element.setTextParsed("Cats &something; Dogs");
>
>as a convenience for
>
>         element.addContent(new Text("Cats "));
>         element.addContent(new EntityRef("something"));
>         element.addContent(new Text(" Dogs"));
>
>be useful or would it be unnecessary clutter in the API? Probably clutter.
>

It is unnecessary clutter. Worse yet, it presents an incorrect 
picture of the structure and semantics of an XML document. Text nodes 
are strings (in JDOM). Entity references are entity references. We 
shouldn't mix them up.
-- 

+-----------------------+------------------------+-------------------+
| 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