From 49a2ae211d3bc1f3c089e52fe7ec8a0c8b0df60f Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Tue, 4 Aug 2009 10:50:08 -0700 Subject: [PATCH] added missing note on getiterator() example --- xml.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xml.html b/xml.html index e97df5b..ef2267c 100755 --- a/xml.html +++ b/xml.html @@ -438,8 +438,8 @@ mark{display:inline} File "<stdin>", line 1, in <module> StopIteration
    -
  1. The getiterator() method can zero or one arguments. If called with no arguments, it returns an iterator that spits out every element and child element in the entire document. Or, as shown here, you can call it with an element name in standard ElementTree format. This returns an iterator that spits out only elements of that name. -
  2. +
  3. The getiterator() method can take zero or one arguments. If called with no arguments, it returns an iterator that spits out every element and child element in the entire document. Or, as shown here, you can call it with an element name in standard ElementTree format. This returns an iterator that spits out only elements of that name. +
  4. Repeatedly calling the next() function with this iterator will eventually return every element of the document that matches the query you passed to the getiterator() method.

Overall, ElementTree’s findall() method is a very powerful feature, but the query language can be a bit surprising. It is officially described as “limited support for XPath expressions.” XPath is a W3C standard for querying XML documents. ElementTree’s query language is similar enough to XPath to do basic searching, but dissimilar enough that it may annoy you if you already know XPath. Now let’s look at a third-party XML library that extends the ElementTree API with full XPath support.