Name
handle_entityref
Synopsis
s
.handle_entityref(ref
)
Called to process an entity reference
'&
ref
;
‘.
SGMLParser
’s implementation of
handle_entityref
looks
ref
up in
s
.entitydefs
, like:
def handle_entityref(self, ref): try: t = self.entitydefs[ref] except KeyError: self.unknown_entityref(ref) else: self.handle_data(t)
Your subclass X
may override
handle_entityref
or
unknown_entityref
in order to support entity
references '&...;
' in different ways.
SGMLParser
’s attribute
entitydefs
includes keys 'amp
',
'apos
', 'gt
',
'lt
', and 'quot
‘.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.