I just got through handling a similar problem. You can use the java.util.regex classes to do bulk replacement of the problem characters. For example, I have a class with:
The replacement operation looks like:
where tmp is a single line of input text - all occurances of the recognized
pattern get replaced with "&".
However, this all gets very tricky with & because the & appears in the encoding for other special characters. So I first change all "& lt;" to "@lt;", (etc), then handle the single &, then change all "@lt;" to "& lt;"
It goes surprisingly fast.
Note that I had to insert spaces in "& lt;" etc in this post to get it to render properly.
Bill
[ October 24, 2004: Message edited by: William Brogden ]
[ October 24, 2004: Message edited by: William Brogden ]