| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="module-xml.sax.saxutils.html" /> |
| 13 | <link rel="prev" href="module-xml.sax.html" /> |
| 14 | <link rel="parent" href="markup.html" /> |
| 15 | <link rel="next" href="content-handler-objects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>13.10 xml.sax.handler -- Base classes for SAX handlers</title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="13.9.1 SAXException Objects" |
| 25 | href="sax-exception-objects.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="13. Structured Markup Processing" |
| 28 | href="markup.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="13.10.1 ContentHandler Objects" |
| 31 | href="content-handler-objects.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="sax-exception-objects.html">13.9.1 SAXException Objects</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="markup.html">13. Structured Markup Processing</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="content-handler-objects.html">13.10.1 ContentHandler Objects</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H1><A NAME="SECTION00151000000000000000000"> |
| 56 | 13.10 <tt class="module">xml.sax.handler</tt> -- |
| 57 | Base classes for SAX handlers</A> |
| 58 | </H1> |
| 59 | |
| 60 | <P> |
| 61 | <A NAME="module-xml.sax.handler"></A> |
| 62 | |
| 63 | <P> |
| 64 | |
| 65 | <span class="versionnote">New in version 2.0.</span> |
| 66 | |
| 67 | <P> |
| 68 | The SAX API defines four kinds of handlers: content handlers, DTD |
| 69 | handlers, error handlers, and entity resolvers. Applications normally |
| 70 | only need to implement those interfaces whose events they are |
| 71 | interested in; they can implement the interfaces in a single object or |
| 72 | in multiple objects. Handler implementations should inherit from the |
| 73 | base classes provided in the module <tt class="module">xml.sax</tt>, so that all |
| 74 | methods get default implementations. |
| 75 | |
| 76 | <P> |
| 77 | <dl><dt><b><span class="typelabel">class</span> <tt id='l2h-4473' xml:id='l2h-4473' class="class">ContentHandler</tt></b> |
| 78 | <dd> |
| 79 | This is the main callback interface in SAX, and the one most |
| 80 | important to applications. The order of events in this interface |
| 81 | mirrors the order of the information in the document. |
| 82 | </dl> |
| 83 | |
| 84 | <P> |
| 85 | <dl><dt><b><span class="typelabel">class</span> <tt id='l2h-4474' xml:id='l2h-4474' class="class">DTDHandler</tt></b> |
| 86 | <dd> |
| 87 | Handle DTD events. |
| 88 | |
| 89 | <P> |
| 90 | This interface specifies only those DTD events required for basic |
| 91 | parsing (unparsed entities and attributes). |
| 92 | </dl> |
| 93 | |
| 94 | <P> |
| 95 | <dl><dt><b><span class="typelabel">class</span> <tt id='l2h-4475' xml:id='l2h-4475' class="class">EntityResolver</tt></b> |
| 96 | <dd> |
| 97 | Basic interface for resolving entities. If you create an object |
| 98 | implementing this interface, then register the object with your |
| 99 | Parser, the parser will call the method in your object to resolve all |
| 100 | external entities. |
| 101 | </dl> |
| 102 | |
| 103 | <P> |
| 104 | <dl><dt><b><span class="typelabel">class</span> <tt id='l2h-4476' xml:id='l2h-4476' class="class">ErrorHandler</tt></b> |
| 105 | <dd> |
| 106 | Interface used by the parser to present error and warning messages |
| 107 | to the application. The methods of this object control whether errors |
| 108 | are immediately converted to exceptions or are handled in some other |
| 109 | way. |
| 110 | </dl> |
| 111 | |
| 112 | <P> |
| 113 | In addition to these classes, <tt class="module">xml.sax.handler</tt> provides |
| 114 | symbolic constants for the feature and property names. |
| 115 | |
| 116 | <P> |
| 117 | <dl><dt><b><tt id='l2h-4477' xml:id='l2h-4477'>feature_namespaces</tt></b></dt> |
| 118 | <dd> |
| 119 | Value: <code>"http://xml.org/sax/features/namespaces"</code> |
| 120 | <BR> |
| 121 | true: Perform Namespace processing. |
| 122 | <BR> |
| 123 | false: Optionally do not perform Namespace processing |
| 124 | (implies namespace-prefixes; default). |
| 125 | <BR> |
| 126 | access: (parsing) read-only; (not parsing) read/write |
| 127 | </dd></dl> |
| 128 | |
| 129 | <P> |
| 130 | <dl><dt><b><tt id='l2h-4478' xml:id='l2h-4478'>feature_namespace_prefixes</tt></b></dt> |
| 131 | <dd> |
| 132 | Value: <code>"http://xml.org/sax/features/namespace-prefixes"</code> |
| 133 | <BR> |
| 134 | true: Report the original prefixed names and attributes used for Namespace |
| 135 | declarations. |
| 136 | <BR> |
| 137 | false: Do not report attributes used for Namespace declarations, and |
| 138 | optionally do not report original prefixed names (default). |
| 139 | <BR> |
| 140 | access: (parsing) read-only; (not parsing) read/write |
| 141 | </dd></dl> |
| 142 | |
| 143 | <P> |
| 144 | <dl><dt><b><tt id='l2h-4479' xml:id='l2h-4479'>feature_string_interning</tt></b></dt> |
| 145 | <dd> |
| 146 | Value: <code>"http://xml.org/sax/features/string-interning"</code> |
| 147 | <BR> |
| 148 | true: All element names, prefixes, attribute names, Namespace URIs, and |
| 149 | local names are interned using the built-in intern function. |
| 150 | <BR> |
| 151 | false: Names are not necessarily interned, although they may be (default). |
| 152 | <BR> |
| 153 | access: (parsing) read-only; (not parsing) read/write |
| 154 | </dd></dl> |
| 155 | |
| 156 | <P> |
| 157 | <dl><dt><b><tt id='l2h-4480' xml:id='l2h-4480'>feature_validation</tt></b></dt> |
| 158 | <dd> |
| 159 | Value: <code>"http://xml.org/sax/features/validation"</code> |
| 160 | <BR> |
| 161 | true: Report all validation errors (implies external-general-entities and |
| 162 | external-parameter-entities). |
| 163 | <BR> |
| 164 | false: Do not report validation errors. |
| 165 | <BR> |
| 166 | access: (parsing) read-only; (not parsing) read/write |
| 167 | </dd></dl> |
| 168 | |
| 169 | <P> |
| 170 | <dl><dt><b><tt id='l2h-4481' xml:id='l2h-4481'>feature_external_ges</tt></b></dt> |
| 171 | <dd> |
| 172 | Value: <code>"http://xml.org/sax/features/external-general-entities"</code> |
| 173 | <BR> |
| 174 | true: Include all external general (text) entities. |
| 175 | <BR> |
| 176 | false: Do not include external general entities. |
| 177 | <BR> |
| 178 | access: (parsing) read-only; (not parsing) read/write |
| 179 | </dd></dl> |
| 180 | |
| 181 | <P> |
| 182 | <dl><dt><b><tt id='l2h-4482' xml:id='l2h-4482'>feature_external_pes</tt></b></dt> |
| 183 | <dd> |
| 184 | Value: <code>"http://xml.org/sax/features/external-parameter-entities"</code> |
| 185 | <BR> |
| 186 | true: Include all external parameter entities, including the external |
| 187 | DTD subset. |
| 188 | <BR> |
| 189 | false: Do not include any external parameter entities, even the external |
| 190 | DTD subset. |
| 191 | <BR> |
| 192 | access: (parsing) read-only; (not parsing) read/write |
| 193 | </dd></dl> |
| 194 | |
| 195 | <P> |
| 196 | <dl><dt><b><tt id='l2h-4483' xml:id='l2h-4483'>all_features</tt></b></dt> |
| 197 | <dd> |
| 198 | List of all features. |
| 199 | </dd></dl> |
| 200 | |
| 201 | <P> |
| 202 | <dl><dt><b><tt id='l2h-4484' xml:id='l2h-4484'>property_lexical_handler</tt></b></dt> |
| 203 | <dd> |
| 204 | Value: <code>"http://xml.org/sax/properties/lexical-handler"</code> |
| 205 | <BR> |
| 206 | data type: xml.sax.sax2lib.LexicalHandler (not supported in Python 2) |
| 207 | <BR> |
| 208 | description: An optional extension handler for lexical events like comments. |
| 209 | <BR> |
| 210 | access: read/write |
| 211 | </dd></dl> |
| 212 | |
| 213 | <P> |
| 214 | <dl><dt><b><tt id='l2h-4485' xml:id='l2h-4485'>property_declaration_handler</tt></b></dt> |
| 215 | <dd> |
| 216 | Value: <code>"http://xml.org/sax/properties/declaration-handler"</code> |
| 217 | <BR> |
| 218 | data type: xml.sax.sax2lib.DeclHandler (not supported in Python 2) |
| 219 | <BR> |
| 220 | description: An optional extension handler for DTD-related events other |
| 221 | than notations and unparsed entities. |
| 222 | <BR> |
| 223 | access: read/write |
| 224 | </dd></dl> |
| 225 | |
| 226 | <P> |
| 227 | <dl><dt><b><tt id='l2h-4486' xml:id='l2h-4486'>property_dom_node</tt></b></dt> |
| 228 | <dd> |
| 229 | Value: <code>"http://xml.org/sax/properties/dom-node"</code> |
| 230 | <BR> |
| 231 | data type: org.w3c.dom.Node (not supported in Python 2) |
| 232 | <BR> |
| 233 | description: When parsing, the current DOM node being visited if this is |
| 234 | a DOM iterator; when not parsing, the root DOM node for |
| 235 | iteration. |
| 236 | <BR> |
| 237 | access: (parsing) read-only; (not parsing) read/write |
| 238 | </dd></dl> |
| 239 | |
| 240 | <P> |
| 241 | <dl><dt><b><tt id='l2h-4487' xml:id='l2h-4487'>property_xml_string</tt></b></dt> |
| 242 | <dd> |
| 243 | Value: <code>"http://xml.org/sax/properties/xml-string"</code> |
| 244 | <BR> |
| 245 | data type: String |
| 246 | <BR> |
| 247 | description: The literal string of characters that was the source for |
| 248 | the current event. |
| 249 | <BR> |
| 250 | access: read-only |
| 251 | </dd></dl> |
| 252 | |
| 253 | <P> |
| 254 | <dl><dt><b><tt id='l2h-4488' xml:id='l2h-4488'>all_properties</tt></b></dt> |
| 255 | <dd> |
| 256 | List of all known property names. |
| 257 | </dd></dl> |
| 258 | |
| 259 | <P> |
| 260 | |
| 261 | <p><br /></p><hr class='online-navigation' /> |
| 262 | <div class='online-navigation'> |
| 263 | <!--Table of Child-Links--> |
| 264 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> |
| 265 | |
| 266 | <UL CLASS="ChildLinks"> |
| 267 | <LI><A href="content-handler-objects.html">13.10.1 ContentHandler Objects</a> |
| 268 | <LI><A href="dtd-handler-objects.html">13.10.2 DTDHandler Objects</a> |
| 269 | <LI><A href="entity-resolver-objects.html">13.10.3 EntityResolver Objects</a> |
| 270 | <LI><A href="sax-error-handler.html">13.10.4 ErrorHandler Objects</a> |
| 271 | </ul> |
| 272 | <!--End of Table of Child-Links--> |
| 273 | </div> |
| 274 | |
| 275 | <DIV CLASS="navigation"> |
| 276 | <div class='online-navigation'> |
| 277 | <p></p><hr /> |
| 278 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 279 | <tr> |
| 280 | <td class='online-navigation'><a rel="prev" title="13.9.1 SAXException Objects" |
| 281 | href="sax-exception-objects.html"><img src='../icons/previous.png' |
| 282 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 283 | <td class='online-navigation'><a rel="parent" title="13. Structured Markup Processing" |
| 284 | href="markup.html"><img src='../icons/up.png' |
| 285 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 286 | <td class='online-navigation'><a rel="next" title="13.10.1 ContentHandler Objects" |
| 287 | href="content-handler-objects.html"><img src='../icons/next.png' |
| 288 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 289 | <td align="center" width="100%">Python Library Reference</td> |
| 290 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 291 | href="contents.html"><img src='../icons/contents.png' |
| 292 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 293 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 294 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 295 | <td class='online-navigation'><a rel="index" title="Index" |
| 296 | href="genindex.html"><img src='../icons/index.png' |
| 297 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 298 | </tr></table> |
| 299 | <div class='online-navigation'> |
| 300 | <b class="navlabel">Previous:</b> |
| 301 | <a class="sectref" rel="prev" href="sax-exception-objects.html">13.9.1 SAXException Objects</A> |
| 302 | <b class="navlabel">Up:</b> |
| 303 | <a class="sectref" rel="parent" href="markup.html">13. Structured Markup Processing</A> |
| 304 | <b class="navlabel">Next:</b> |
| 305 | <a class="sectref" rel="next" href="content-handler-objects.html">13.10.1 ContentHandler Objects</A> |
| 306 | </div> |
| 307 | </div> |
| 308 | <hr /> |
| 309 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 310 | </DIV> |
| 311 | <!--End of Navigation Panel--> |
| 312 | <ADDRESS> |
| 313 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 314 | </ADDRESS> |
| 315 | </BODY> |
| 316 | </HTML> |