Name
LexicalHandler
Synopsis
The LexicalHandler is
used to receive information about syntactical events such as CDATA section boundaries and comments in a
document. It is only supported using PyXML; the standard library does
not provide this. A simple base class for this handler is available as
the LexicalHandler class in the
xml.sax.saxlib module. The LexicalHandler can be set using the setProperty method on the parser object,
using the property constant property_lexical_handler from the xml.sax.handler module.
comment(text)This method is called when the parser finds a comment in the document. The body of the comment, between the two occurrences of
--, is passed as thetextparameter.startDTD( )This method is called before the parser starts reading any DTD information, regardless of whether that information is in the internal or external subset. This method is called at most once.
endDTD( )The parser calls this method after all DTD information is read; it is called at most once.
startEntity(name)This method is called when the parser begins parsing the entity associated with the name
namein the DTD. The only way to know about the names defined in the DTD is to provide aDeclHandlerand implement theexternalEntityDeclandinternalEntityDeclmethods.endEntity(name)The parser calls this method when it is finished parsing the entity identified by
name. SeestartEntityfor information about using entity names.startCDATA( )This method is called at the start of a
CDATAsection. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access