[jdom-interest] my last CDATA comment (I promise)

Jason Hunter jhunter at acm.org
Sat Jun 3 12:54:14 PDT 2000

> Now, you can imagine the huge efficiency hit that the
> second output method causes.  We have to (1) create a
> StringBuffer for the new string, (2) look at every character
> in the output against 4 possible restricted characters
> in a switch statement, (3) replace 1 character with 4
> (or 5 for &) characters for each escaped character,
> (4) create a new String from the newly created StringBuffer
> (oh, and (0) call the escape method in the first place).
> For the first output we (1) do nothing special.  We just
> output the string as is (wrapped in <![CDATA[...]]>).

Not entirely true.  You have to search the CDATA text for the CDATA
terminal string and escape it wherever it should appear.


More information about the jdom-interest mailing list