[jdom-interest] Merging text nodes

Bradley S. Huffman hip at a.cs.okstate.edu
Sun Feb 17 13:36:15 PST 2002

Elliotte Rusty Harold writes:

> At 11:30 PM -0600 2/16/02, Bradley S. Huffman wrote:
> >Speaking of EntityRef, should Element.setText parse the String for entities?
> Absolutely not. "Cats & Dogs" is legal content for a text node. 
> It consists of 15 characters including the ampersand followed by the 
> three letters a, m, p. and the semicolon.

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.


More information about the jdom-interest mailing list