[jdom-interest] Merging text nodes

Bradley S. Huffman hip at a.cs.okstate.edu
Sat Feb 16 21:30:59 PST 2002


Elliotte Rusty Harold writes:

> >Would a method like Element.getText(Map) be useful for concatinating Text,
> >CDATA, and EntityRef into a String?
> >
> At first hearing, it sounds too complicated and not really extensible 
> in the long term.

I not suggesting anything complicated just a convenience to make
Element.getText a little more useful by giving developers a easy way to map
EntityRef names to the String they want inserted in the result String. The
default would be to wrap EntityRef name in &; like XMLOutputter. But if they 
provide a Map that maps String->Object then Object.toString is used.
Maintaining the Map and it's contents would be their responsiblity.

Speaking of EntityRef, should Element.setText parse the String for entities?

Brad



More information about the jdom-interest mailing list