Name

XMLReader

Synopsis

This is the basic parser interface used in SAX 2. It provides methods to get and set the handler objects and a control variety of configurable options.

parse( source )

Starts the parser working on the document in the entity identified by source. The parameter may be a filename, a URL, or an InputSource object. The InputSource interface is described later in this Appendix.

getContentHandler( )

Returns the currently configured content handler, or None if there isn’t one.

getDTDHandler( )

Returns the currently configured DTD handler, or None if there isn’t one.

getEntityResolver( )

Returns the currently configured entity resolver, or None if there isn’t one.

getErrorHandler( )

Returns the currently configured error handler, or None if there isn’t one.

getFeature( name )

Get the current Boolean value for the feature identified by name. This method returns true if the feature is enabled, and false if it is disabled, or it raises the SAXNotRecognized or SAXNotSupported exception if name is not known or supported.

getProperty( name )

Returns the current value of the property identified by name. This method returns whatever Python object is appropriate for the specific property; the application must be written to follow the rules associated with that property. If the specific property for which the value is requested is not known or supported by the parser, the appropriate subclass of the SAXException is raised as an exception.

setContentHandler( handler )

Sets the content ...

Get Python & XML 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.