xml.etree.ElementTree.XMLPullParser.read_events()

read_events() Return an iterator over the events which have been encountered in the data fed to the parser. The iterator yields (event, elem) pairs, where event is a string representing the type of event (e.g. "end") and elem is the encountered Element object. Events provided in a previous call to read_events() will not be yielded again. Events are consumed from the internal queue only when they are retrieved from the iterator, so multiple readers iterating in parallel over iterators obtaine

xml.etree.ElementTree.XMLPullParser.close()

close() Signal the parser that the data stream is terminated. Unlike XMLParser.close(), this method always returns None. Any events not yet retrieved when the parser is closed can still be read with read_events().

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.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.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.doctype()

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

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.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.

xml.etree.ElementTree.TreeBuilder.close()

close() Flushes the builder buffers, and returns the toplevel document element. Returns an Element instance.

xml.etree.ElementTree.TreeBuilder.data()

data(data) Adds text to the current element. data is a string. This should be either a bytestring, or a Unicode string.