[jdom-interest] any way to suppress entity expansion?

Gordon Tyler gordon.tyler at sitraka.com
Fri Apr 25 08:49:15 PDT 2003


Michael Stacey wrote:
> We are trying to use a JDom in a system that needs to store the
> actual content with entities intact.  ie:
> 
> this &amp; that are <b>cool</b>
> 
> Creating an Element with this string gives the expected:
> 
> this &amp;amp; that are &lt;b&gt;cool&lt;/b&gt;
> 
> Any way to suppress this translation?

Nope. You have to build the document properly:

Element parent = new Element("stuff");
parent.addContent("this ");
parent.addContent(new EntityRef("amp"));
parent.addContent(" that are ");
Element b = new Element("b");
b.addContent("cool");
parent.addContent(b);

Ciao,
Gordon

-- 
Gordon Tyler (Software Developer)
Quest Software <http://java.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: 416-643-4846 | Fax: 416-594-1919




More information about the jdom-interest mailing list