[jdom-interest] Special characters in Text or the Tag

Ian Lea ian.lea at blackwell.co.uk
Tue May 22 02:05:12 PDT 2001

You typically don't have to worry about it.  In your example
if you have

 String s = "lskjflks/ljf/&";
 Element e = new Element("title").setText(s);

then a subsequent call to e.getText() will return
the same string because the & will have been
converted to & and then back to & again.


Bhanu Pabreja wrote:
> I am very new to xml so this question is very very trivial.
> String s = "lskjflks/ljf/&"; //  actually read from the database so I cant
> predict when it will have characters which have special meaning to the
> parser.
> My xml
> new Element("title").setText(s);
> Now how can handle this situation so that my text appears normally i.e.
> without & kind of diaplay while outputing &.
> Help will be higly appreciated.
> dumdum

More information about the jdom-interest mailing list