PyDocs

Structured Markup Processing Tools

xml.parsers.expat

Interface to the Expat non-validating XML parser.
Symbols in xml.parsers.expat

e

error
Alias for ExpatError.
ErrorString
Returns string error for given number.
EXPAT_VERSION
The version string of the Expat library loaded by the interpreter, like 'expat_2.8.4'.
ExpatError
The exception raised when Expat reports an error.

f

features
The list of the features with which the loaded Expat library was compiled, as (name, value) pairs.

p

ParserCreate
Return a new XML parser object.

v

version_info
The version of the Expat library loaded by the interpreter, as a tuple of three integers: major, minor and micro version.

x

xmlparser.AttlistDeclHandler
Called for each declared attribute for an element type.
xmlparser.buffer_size
The size of the buffer used when buffer_text is true.
xmlparser.buffer_text
Setting this to true causes the xmlparser object to buffer textual content returned by Expat to avoid multiple calls to the CharacterDataHandler() callback whenever possible.
xmlparser.buffer_used
If buffer_text is enabled, the number of bytes stored in the buffer.
xmlparser.CharacterDataHandler
Called for character data.
xmlparser.CommentHandler
Called for comments.
xmlparser.CurrentByteIndex
Current byte index in the parser input.
xmlparser.CurrentColumnNumber
Current column number in the parser input.
xmlparser.CurrentLineNumber
Current line number in the parser input.
xmlparser.DefaultHandler
Called for any characters in the XML document for which no applicable handler has been specified.
xmlparser.DefaultHandlerExpand
This is the same as the DefaultHandler, but doesn’t inhibit expansion of internal entities.
xmlparser.ElementDeclHandler
Called once for each element type declaration.
xmlparser.EndCdataSectionHandler
Called at the end of a CDATA section.
xmlparser.EndDoctypeDeclHandler
Called when Expat is done parsing the document type declaration.
xmlparser.EndElementHandler
Called for the end of every element.
xmlparser.EndNamespaceDeclHandler
Called when the closing tag is reached for an element that contained a namespace declaration.
xmlparser.EntityDeclHandler
Called for all entity declarations.
xmlparser.ErrorByteIndex
Byte index at which an error occurred.
xmlparser.ErrorCode
Numeric code specifying the problem.
xmlparser.ErrorColumnNumber
Column number at which an error occurred.
xmlparser.ErrorLineNumber
Line number at which an error occurred.
xmlparser.ExternalEntityParserCreate
Create a “child” parser which can be used to parse an external parsed entity referred to by content parsed by the parent parser.
xmlparser.ExternalEntityRefHandler
Called for references to external entities.
xmlparser.GetBase
Returns a string containing the base set by a previous call to SetBase(), or None if SetBase() hasn’t been called.
xmlparser.GetInputContext
Returns the input data which generated the current event as a bytes object.
xmlparser.GetReparseDeferralEnabled
Returns whether reparse deferral is currently enabled for the given Expat parser instance.
xmlparser.intern
The dictionary used to intern the names of elements and attributes.
xmlparser.namespace_prefixes
If set to a true value, and namespace processing is enabled, the namespace prefix is reported as the third part of the expanded name, separated by the namespace separator.
xmlparser.NotationDeclHandler
Called for notation declarations.
xmlparser.NotStandaloneHandler
Called if the XML document hasn’t been declared as being a standalone document.
xmlparser.ordered_attributes
Setting this attribute to a non-zero integer causes the attributes to be reported as a list rather than a dictionary.
xmlparser.Parse
Parses the contents of data, calling the appropriate handler functions to process the parsed data.
xmlparser.ParseFile
Parse XML data reading from the object file.
xmlparser.ProcessingInstructionHandler
Called for every processing instruction.
xmlparser.SetAllocTrackerActivationThreshold
Sets the number of allocated bytes of dynamic memory needed to activate protection against disproportionate use of RAM.
xmlparser.SetAllocTrackerMaximumAmplification
Sets the maximum amplification factor between direct input and bytes of dynamic memory allocated.
xmlparser.SetBase
Sets the base to be used for resolving relative URIs in system identifiers in declarations.
xmlparser.SetBillionLaughsAttackProtectionActivationThreshold
Sets the number of output bytes needed to activate protection against billion laughs attacks.
xmlparser.SetBillionLaughsAttackProtectionMaximumAmplification
Sets the maximum tolerated amplification factor for protection against billion laughs attacks.
xmlparser.SetParamEntityParsing
Control parsing of parameter entities (including the external DTD subset).
xmlparser.SetReparseDeferralEnabled
Expat 2.6.0 introduced a security mechanism called “reparse deferral” where instead of causing denial of service through quadratic runtime from reparsing large tokens, reparsing of unfinished tokens …
xmlparser.SkippedEntityHandler
Called for entity references which are not expanded, because the parser did not read the declaration of the entity.
xmlparser.specified_attributes
If set to a non-zero integer, the parser will report only those attributes which were specified in the document instance and not those which were derived from attribute declarations.
xmlparser.StartCdataSectionHandler
Called at the start of a CDATA section.
xmlparser.StartDoctypeDeclHandler
Called when Expat begins parsing the document type declaration (<!DOCTYPE ...).
xmlparser.StartElementHandler
Called for the start of every element.
xmlparser.StartNamespaceDeclHandler
Called when an element contains a namespace declaration.
xmlparser.UnparsedEntityDeclHandler
Called for unparsed (NDATA) entity declarations.
xmlparser.UseForeignDTD
Calling this with a true value for flag (the default) will cause Expat to call the ExternalEntityRefHandler with None for all arguments to allow an alternate DTD to be loaded.
xmlparser.XmlDeclHandler
Called when the XML declaration is parsed.
XMLParserType
XML parser