]> granicus.if.org Git - python/commitdiff
[Apply patch #500457 from the PyXML tracker]
authorAndrew M. Kuchling <amk@amk.ca>
Wed, 20 Mar 2002 23:56:34 +0000 (23:56 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Wed, 20 Mar 2002 23:56:34 +0000 (23:56 +0000)
Add iterator support to pulldom.DOMEventStream

New feature, so not a bugfix candidate (though it should be safe for inclusion)

Lib/xml/dom/pulldom.py

index adc978e9a995ad96377e83487c2756e9fba986aa..255689c48871b158572ec799f044817a6b279d2e 100644 (file)
@@ -227,6 +227,15 @@ class DOMEventStream:
             return rc
         raise IndexError
 
+    def next(self):
+        rc = self.getEvent()
+        if rc:
+            return rc
+        raise StopIteration
+
+    def __iter__(self):
+        return self
+    
     def expandNode(self, node):
         event = self.getEvent()
         parents = [node]