PyDocs

Nav

Structured Markup Processing Tools

iterparse

xml.etree.ElementTree

function (source) Deprecated 3.4
  • iterparse(source, events=None, parser=None)
Deprecated since 3.4. The parser argument.
Incrementally parse XML document into ElementTree.

This class also reports what's going on to the user based on the
*events* it is initialized with.  The supported events are the strings
"start", "end", "start-ns" and "end-ns" (the "ns" events are used to get
detailed namespace information).  If *events* is omitted, only
"end" events are reported.

*source* is a filename or file object containing XML data, *events* is
a list of events to report back, *parser* is an optional parser
instance.

Returns an iterator providing (event, elem) pairs.
Changed in 3.8, 3.13, 3.15
  • 3.8: The comment and pi events were added.
  • 3.13: Added the close() method.
  • 3.15: A ResourceWarning is now emitted if the iterator opened a file and is not explicitly closed.
0 Examples
No examples for xml.etree.ElementTree/iterparse.
See Also
No see-alsos for xml.etree.ElementTree/iterparse
0 Notes
No notes for iterparse