xml.parsers.expat.xmlparser.SetBase()

xmlparser.SetBase(base) Sets the base to be used for resolving relative URIs in system identifiers in declarations. Resolving relative identifiers is left to the application: this value will be passed through as the base argument to the ExternalEntityRefHandler(), NotationDeclHandler(), and UnparsedEntityDeclHandler() functions.

xml.parsers.expat.xmlparser.Parse()

xmlparser.Parse(data[, isfinal]) Parses the contents of the string data, calling the appropriate handler functions to process the parsed data. isfinal must be true on the final call to this method; it allows the parsing of a single file in fragments, not the submission of multiple files. data can be the empty string at any time.

xml.parsers.expat.xmlparser.GetInputContext()

xmlparser.GetInputContext() Returns the input data that generated the current event as a string. The data is in the encoding of the entity which contains the text. When called while an event handler is not active, the return value is None.

xml.parsers.expat.xmlparser.ExternalEntityRefHandler()

xmlparser.ExternalEntityRefHandler(context, base, systemId, publicId) Called for references to external entities. base is the current base, as set by a previous call to SetBase(). The public and system identifiers, systemId and publicId, are strings if given; if the public identifier is not given, publicId will be None. The context value is opaque and should only be used as described below. For external entities to be parsed, this handler must be implemented. It is responsible for creating t

xml.parsers.expat.xmlparser.GetBase()

xmlparser.GetBase() Returns a string containing the base set by a previous call to SetBase(), or None if SetBase() hasn’t been called.

xml.parsers.expat.xmlparser.NotationDeclHandler()

xmlparser.NotationDeclHandler(notationName, base, systemId, publicId) Called for notation declarations. notationName, base, and systemId, and publicId are strings if given. If the public identifier is omitted, publicId will be None.

xml.parsers.expat.xmlparser.ErrorCode

xmlparser.ErrorCode Numeric code specifying the problem. This value can be passed to the ErrorString() function, or compared to one of the constants defined in the errors object.

xml.parsers.expat.xmlparser.EntityDeclHandler()

xmlparser.EntityDeclHandler(entityName, is_parameter_entity, value, base, systemId, publicId, notationName) Called for all entity declarations. For parameter and internal entities, value will be a string giving the declared contents of the entity; this will be None for external entities. The notationName parameter will be None for parsed entities, and the name of the notation for unparsed entities. is_parameter_entity will be true if the entity is a parameter entity or false for general enti

xml.parsers.expat.xmlparser.EndNamespaceDeclHandler()

xmlparser.EndNamespaceDeclHandler(prefix) Called when the closing tag is reached for an element that contained a namespace declaration. This is called once for each namespace declaration on the element in the reverse of the order for which the StartNamespaceDeclHandler was called to indicate the start of each namespace declaration’s scope. Calls to this handler are made after the corresponding EndElementHandler for the end of the element.

xml.parsers.expat.xmlparser.ExternalEntityParserCreate()

xmlparser.ExternalEntityParserCreate(context[, encoding]) Create a “child” parser which can be used to parse an external parsed entity referred to by content parsed by the parent parser. The context parameter should be the string passed to the ExternalEntityRefHandler() handler function, described below. The child parser is created with the ordered_attributes and specified_attributes set to the values of this parser.