From 7a568ff22ad4813760b9e990b1d1fb37d802513c Mon Sep 17 00:00:00 2001 From: Prometheus Date: Tue, 22 Nov 2022 16:50:11 +0300 Subject: [PATCH 1/3] gh-93607: document root attribute of iterparse --- Doc/library/xml.etree.elementtree.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst index 2fe0d2e082fb3a..18ee2aba58fb16 100644 --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -628,6 +628,9 @@ Functions for applications where blocking reads can't be made. For fully non-blocking parsing, see :class:`XMLPullParser`. + Once *source* is fully read, the returned :term:`iterator` object is populated with a ``root`` + attribute which references to the root element of the resulting XML tree. + .. note:: :func:`iterparse` only guarantees that it has seen the ">" character of a From ea047192d11feacd7858f3b9337c3f9aef9709bd Mon Sep 17 00:00:00 2001 From: Prometheus3375 Date: Mon, 28 Nov 2022 16:42:41 +0300 Subject: [PATCH 2/3] gh-93607: remove redundant "to" Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com> --- Doc/library/xml.etree.elementtree.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst index 18ee2aba58fb16..86b57356bd536c 100644 --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -629,7 +629,7 @@ Functions parsing, see :class:`XMLPullParser`. Once *source* is fully read, the returned :term:`iterator` object is populated with a ``root`` - attribute which references to the root element of the resulting XML tree. + attribute which references the root element of the resulting XML tree. .. note:: From 20579f073fcdb37d3c0311e880063b28b21ef06e Mon Sep 17 00:00:00 2001 From: Prometheus3375 Date: Fri, 2 Dec 2022 16:18:33 +0300 Subject: [PATCH 3/3] apply more correct variant --- Doc/library/xml.etree.elementtree.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst index 86b57356bd536c..ed1b186e194c6b 100644 --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -621,16 +621,15 @@ Functions *parser* is an optional parser instance. If not given, the standard :class:`XMLParser` parser is used. *parser* must be a subclass of :class:`XMLParser` and can only use the default :class:`TreeBuilder` as a - target. Returns an :term:`iterator` providing ``(event, elem)`` pairs. + target. Returns an :term:`iterator` providing ``(event, elem)`` pairs; + it has a ``root`` attribute that references the root element of the + resulting XML tree once *source* is fully read. Note that while :func:`iterparse` builds the tree incrementally, it issues blocking reads on *source* (or the file it names). As such, it's unsuitable for applications where blocking reads can't be made. For fully non-blocking parsing, see :class:`XMLPullParser`. - Once *source* is fully read, the returned :term:`iterator` object is populated with a ``root`` - attribute which references the root element of the resulting XML tree. - .. note:: :func:`iterparse` only guarantees that it has seen the ">" character of a