xml.parsers.expat.xmlparser.StartDoctypeDeclHandler()

xmlparser.StartDoctypeDeclHandler(doctypeName, systemId, publicId, has_internal_subset) Called when Expat begins parsing the document type declaration (<!DOCTYPE ...). The doctypeName is provided exactly as presented. The systemId and publicId parameters give the system and public identifiers if specified, or None if omitted. has_internal_subset will be true if the document contains and internal document declaration subset. This requires Expat version 1.2 or newer.

xml.parsers.expat.xmlparser.UseForeignDTD()

xmlparser.UseForeignDTD([flag]) 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. If the document does not contain a document type declaration, the ExternalEntityRefHandler will still be called, but the StartDoctypeDeclHandler and EndDoctypeDeclHandler will not be called. Passing a false value for flag will cancel a previous call that passed a true value, but otherwis

xml.parsers.expat.xmlparser.StartElementHandler()

xmlparser.StartElementHandler(name, attributes) Called for the start of every element. name is a string containing the element name, and attributes is the element attributes. If ordered_attributes is true, this is a list (see ordered_attributes for a full description). Otherwise it’s a dictionary mapping names to values.

xml.parsers.expat.xmlparser.specified_attributes

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. Applications which set this need to be especially careful to use what additional information is available from the declarations as needed to comply with the standards for the behavior of XML processors. By default, this attribute is false; it may be changed at any time.

xml.parsers.expat.xmlparser.UnparsedEntityDeclHandler()

xmlparser.UnparsedEntityDeclHandler(entityName, base, systemId, publicId, notationName) Called for unparsed (NDATA) entity declarations. This is only present for version 1.2 of the Expat library; for more recent versions, use EntityDeclHandler instead. (The underlying function in the Expat library has been declared obsolete.)

xml.parsers.expat.xmlparser.SetParamEntityParsing()

xmlparser.SetParamEntityParsing(flag) Control parsing of parameter entities (including the external DTD subset). Possible flag values are XML_PARAM_ENTITY_PARSING_NEVER, XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE and XML_PARAM_ENTITY_PARSING_ALWAYS. Return true if setting the flag was successful.

xml.parsers.expat.xmlparser.ParseFile()

xmlparser.ParseFile(file) Parse XML data reading from the object file. file only needs to provide the read(nbytes) method, returning the empty string when there’s no more data.

xml.parsers.expat.xmlparser.NotStandaloneHandler()

xmlparser.NotStandaloneHandler() Called if the XML document hasn’t been declared as being a standalone document. This happens when there is an external subset or a reference to a parameter entity, but the XML declaration does not set standalone to yes in an XML declaration. If this handler returns 0, then the parser will raise an XML_ERROR_NOT_STANDALONE error. If this handler is not set, no exception is raised by the parser for this condition.

xml.parsers.expat.xmlparser.ordered_attributes

xmlparser.ordered_attributes Setting this attribute to a non-zero integer causes the attributes to be reported as a list rather than a dictionary. The attributes are presented in the order found in the document text. For each attribute, two list entries are presented: the attribute name and the attribute value. (Older versions of this module also used this format.) By default, this attribute is false; it may be changed at any time.

xml.parsers.expat.xmlparser.ProcessingInstructionHandler()

xmlparser.ProcessingInstructionHandler(target, data) Called for every processing instruction.