xml.sax.saxutils.prepare_input_source()

xml.sax.saxutils.prepare_input_source(source, base='') This function takes an input source and an optional base URL and returns a fully resolved InputSource object ready for reading. The input source can be given as a string, a file-like object, or an InputSource object; parsers will use this function to implement the polymorphic source argument to their parse() method.

xml.sax.saxutils.escape()

xml.sax.saxutils.escape(data, entities={}) Escape '&', '<', and '>' in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. The characters '&', '<' and '>' are always escaped, even if entities is provided.

xml.sax.SAXParseException

exception xml.sax.SAXParseException(msg, exception, locator) Subclass of SAXException raised on parse errors. Instances of this class are passed to the methods of the SAX ErrorHandler interface to provide information about the parse error. This class supports the SAX Locator interface as well as the SAXException interface.

xml.sax.SAXNotSupportedException

exception xml.sax.SAXNotSupportedException(msg, exception=None) Subclass of SAXException raised when a SAX XMLReader is asked to enable a feature that is not supported, or to set a property to a value that the implementation does not support. SAX applications and extensions may use this class for similar purposes.

xml.sax.SAXNotRecognizedException

exception xml.sax.SAXNotRecognizedException(msg, exception=None) Subclass of SAXException raised when a SAX XMLReader is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.

xml.sax.SAXException.getMessage()

SAXException.getMessage() Return a human-readable message describing the error condition.

xml.sax.SAXException.getException()

SAXException.getException() Return an encapsulated exception object, or None.

xml.sax.SAXException

exception xml.sax.SAXException(msg, exception=None) Encapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: it can be subclassed to provide additional functionality or to add localization. Note that although the handlers defined in the ErrorHandler interface receive instances of this exception, it is not required to actually raise the exception — it is also useful as a container for information. When instan

xml.sax.parseString()

xml.sax.parseString(string, handler, error_handler=handler.ErrorHandler()) Similar to parse(), but parses from a buffer string received as a parameter. string must be a str instance or a bytes-like object. Changed in version 3.5: Added support of str instances.

xml.sax.parse()

xml.sax.parse(filename_or_stream, handler, error_handler=handler.ErrorHandler()) Create a SAX parser and use it to parse a document. The document, passed in as filename_or_stream, can be a filename or a file object. The handler parameter needs to be a SAX ContentHandler instance. If error_handler is given, it must be a SAX ErrorHandler instance; if omitted, SAXParseException will be raised on all errors. There is no return value; all work must be done by the handler passed in.