Unicode ampersand

Hi,

Using the JDOM method element.setText all ‘&’ are changed to ‘& amp ;’
But in case of an unicode character inserted like ‘& # 123 ;’ this is not useful.

What I’m doing:
ContentElement is a String that I get from a html form which can contain an unicode character like ‘& # 123 ;’
In document the unicode string is changed to ‘& amp ; # 123 ;’ by setText.
After that I insert the document as TXMLObject in tamino.

TXMLObjectAccessor accessor = con.newXMLObjectAccessor (...) ;
			
Element root = new Element("Rootelement");   
Document document = new Document(root);
root.addContent(new Element("FirstElement").setText(ContentElement));
			
TXMLObject xo = TXMLObject.newInstance (document);
accessor.insert(xo);

How can I prevent the change of an ampersand in an unicode term?
Is there a possibility to change in document or in TXMLObject from '& amp ; # ’ to '& # ’ ?

From what I’ve seen you can’t keep JDOM from escaping the ampersand. What you need to do is translate the character reference from your input string into the correct Unicode character before invoking the setText method.