XML Processing Modules

xml.parsers.expat.errors

Exposes Expat error message constants and mappings between error codes and descriptions. The named XML_ERROR constants are strings, not numeric exception codes. Use codes to translate a constant into a numeric code and messages for the reverse. The namespace is supplied by the extension module.

Formal Syntax & Structure

python syntaxpython
import xml.parsers.expat.errors

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from xml.parsers.expat import errorscode = errors.codes[errors.XML_ERROR_SYNTAX]print(errors.messages[code] == errors.XML_ERROR_SYNTAX)
Python Reference