The following constants are provided in the errors object of
the xml.parsers.expat module. These constants are useful
in interpreting some of the attributes of the ExpatError
exception objects raised when an error has occurred.
The errors object has the following attributes:
An entity reference in an attribute value referred to an external
entity instead of an internal entity.
A character reference referred to a character which is illegal in XML
(for example, character 0, or `�').
An entity reference referred to an entity which was declared with a
notation, so cannot be parsed.
An attribute was used more than once in a start tag.
Raised when an input byte could not properly be assigned to a
character; for example, a NUL byte (value 0) in a UTF-8 input
Something other than whitespace occurred after the document element.
An XML declaration was found somewhere other than the start of the
The document contains no elements (XML requires all documents to
contain exactly one top-level element)..
Expat was not able to allocate memory internally.
A parameter entity reference was found where it was not allowed.
An incomplete character was found in the input.
An entity reference contained another reference to the same entity;
possibly via a different name, and possibly indirectly.
Some unspecified syntax error was encountered.
An end tag did not match the innermost open start tag.
Some token (such as a start tag) was not closed before the end of the
stream or the next token was encountered.
A reference was made to a entity which was not defined.
The document encoding is not supported by Expat.
A CDATA marked section was not closed.
The parser determined that the document was not ``standalone'' though
it declared itself to be in the XML declaration, and the
NotStandaloneHandler was set and returned 0.
An operation was requested that requires DTD support to be compiled
in, but Expat was configured without DTD support. This should never
be reported by a standard build of the xml.parsers.expat
A behavioral change was requested after parsing started that can only
be changed before parsing has started. This is (currently) only
raised by UseForeignDTD().
An undeclared prefix was found when namespace processing was enabled.
The document attempted to remove the namespace declaration associated
with a prefix.
A parameter entity contained incomplete markup.
The document contained no document element at all.
There was an error parsing a text declaration in an external entity.
Characters were found in the public id that are not allowed.
The requested operation was made on a suspended parser, but isn't
allowed. This includes attempts to provide additional input or to
stop the parser.
An attempt to resume the parser was made when the parser had not been
This should not be reported to Python applications.
The requested operation was made on a parser which was finished
parsing input, but isn't allowed. This includes attempts to provide
additional input or to stop the parser.