On the Stre@m

Technical
...
The serpent is crawling inside of
your ear
He says you must vote for what you
want to hear
Dont matter whats wrong as long as
youre alright
So pull yourself stupid and rob
yourself blind
(dickinson/gers)

Character reference - SAX
Character reference reporting from SAX.

I found myself in the position to work with SAX and to construct some data structure based on a xml. In the xml there were charactere references along with other special characters like 鮠I needed to know when I got each of them so to construct the data structure correctly. Normally SAX is reporting both in the same way using characters() method from DefaultHandler. I posted this request of mine on bugzilla and Neil Graham was kind enough to tel me about this undocumented feature that SAX has:
http://apache.org/xml/features/scanner/notify-char-refs
Setting this on true will make SAX to report character references the same way as entities. But here is the code:

SAXParser xr = new SAXParser();
try {
  xr.setFeature("http://apache.org/xml/features/scanner/notify-char-refs", true);
} catch (Exception e) {
  System.out.println("Feature not supported");
}

Page 1 of 1