March 2003
Intermediate to advanced
656 pages
39h 30m
English
handle_charref
s.handle_charref(ref)Called to process a character reference
'&#
ref
;‘.
SGMLParser’s implementation of
handle_charref handles decimal numbers in
range(0,256), like:
def handle_charref(self, ref):
try:
c = chr(int(ref))
except (TypeError, ValueError):
self.unknown_charref(ref)
else: self.handle_data(c)Your subclass X may override
handle_charref or
unknown_charref in order to support other forms of
character references '&#...;‘.
Read now
Unlock full access