xml.etree.ElementTree.XMLPullParser

class xml.etree.ElementTree.XMLPullParser(events=None) A pull parser suitable for non-blocking applications. Its input-side API is similar to that of XMLParser, but instead of pushing calls to a callback target, XMLPullParser collects an internal list of parsing events and lets the user read from it. events is a sequence of events to report back. The supported events are the strings "start", "end", "start-ns" and "end-ns" (the “ns” events are used to get detailed namespace information). If e

xml.etree.ElementTree.XMLParser.feed()

feed(data) Feeds data to the parser. data is encoded data.

xml.etree.ElementTree.XMLParser.doctype()

doctype(name, pubid, system) Deprecated since version 3.2: Define the TreeBuilder.doctype() method on a custom TreeBuilder target.

xml.etree.ElementTree.XMLParser.close()

close() Finishes feeding data to the parser. Returns the result of calling the close() method of the target passed during construction; by default, this is the toplevel document element.

xml.etree.ElementTree.XMLParser

class xml.etree.ElementTree.XMLParser(html=0, target=None, encoding=None) This class is the low-level building block of the module. It uses xml.parsers.expat for efficient, event-based parsing of XML. It can be fed XML data incrementally with the feed() method, and parsing events are translated to a push API - by invoking callbacks on the target object. If target is omitted, the standard TreeBuilder is used. The html argument was historically used for backwards compatibility and is now depre

xml.etree.ElementTree.XMLID()

xml.etree.ElementTree.XMLID(text, parser=None) Parses an XML section from a string constant, and also returns a dictionary which maps from element id:s to elements. text is a string containing XML data. parser is an optional parser instance. If not given, the standard XMLParser parser is used. Returns a tuple containing an Element instance and a dictionary.

xml.etree.ElementTree.XML()

xml.etree.ElementTree.XML(text, parser=None) Parses an XML section from a string constant. This function can be used to embed “XML literals” in Python code. text is a string containing XML data. parser is an optional parser instance. If not given, the standard XMLParser parser is used. Returns an Element instance.

xml.etree.ElementTree.TreeBuilder.start()

start(tag, attrs) Opens a new element. tag is the element name. attrs is a dictionary containing element attributes. Returns the opened element.

xml.etree.ElementTree.TreeBuilder.end()

end(tag) Closes the current element. tag is the element name. Returns the closed element.

xml.etree.ElementTree.TreeBuilder.doctype()

doctype(name, pubid, system) Handles a doctype declaration. name is the doctype name. pubid is the public identifier. system is the system identifier. This method does not exist on the default TreeBuilder class. New in version 3.2.