[jdom-interest] SAXHandler / CDATA / entities
Ingo Struck
ingo at ingostruck.de
Mon Nov 18 12:46:25 PST 2002
Hi folks,
the inability of jdom to cope with CDATA sections is really a great
drawback.
To be halfway useful, at least the character escaping should work properly
(i.e. encoding of the five "evil" chars AMP, LT, GT, QUOTE, APOS).
I propose the following fix in SAXHandler java, such that the numerical
escaping (with the great advantage of uniform length for all escaped chars)
works as well:
public void startEntity(String name) throws SAXException {
[...]
// Ignore DTD references, and translate the standard 5
if ((!inDTD) &&
(!name.equals("amp")) && (!name.equals( "#38" )) && (!name.equals(
"#x26" ))
&& (!name.equals("lt")) && (!name.equals( "#60" )) &&
(!name.equals( "#x3C" ))
&& (!name.equals("gt")) && (!name.equals( "#62" )) &&
(!name.equals( "#x3E" ))
&& (!name.equals("apos")) && (!name.equals( "#39" )) &&
(!name.equals( "#x27" ))
&& (!name.equals("quot")) && (!name.equals( "#34" )) &&
(!name.equals( "#x22" ))
) {
[...]
Still a proper CDATA handling would be really great for the release anyway.
Kind regards
Ingo Struck
--
ingo at ingostruck.de
Use PGP: http://ingostruck.de/ingostruck.gpg with fingerprint
C700 9951 E759 1594 0807 5BBF 8508 AF92 19AA 3D24
More information about the jdom-interest
mailing list