Package lxml :: Module etree :: Class iterwalk
[hide private]
[frames] | no frames]

Class iterwalk

object --+
         |
        iterwalk

iterwalk(self, element_or_tree, events=("end",), tag=None)

A tree walker that generates events from an existing tree as if it was parsing XML data with iterparse().

Just as for iterparse(), the tag argument can be a single tag or a sequence of tags.

After receiving a 'start' or 'start-ns' event, the children and descendants of the current element can be excluded from iteration by calling the skip_subtree() method.

Instance Methods [hide private]
 
__init__(self, element_or_tree, events=("end", ), tag=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__iter__(x)
iter(x)
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__next__(...)
the next value, or raise StopIteration
next(x)
 
skip_subtree(...)
Prevent descending into the current subtree. Instead, the next returned event will be the 'end' event of the current element (if included), ignoring any children or descendants.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, element_or_tree, events=("end", ), tag=None)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

skip_subtree(...)

 

Prevent descending into the current subtree. Instead, the next returned event will be the 'end' event of the current element (if included), ignoring any children or descendants.

This has no effect right after an 'end' or 'end-ns' event.