Class ElementDepthFirstIterator
object --+
|
_ElementTagMatcher --+
|
ElementDepthFirstIterator
ElementDepthFirstIterator(self, node, tag=None, inclusive=True)
Iterates over an element and its sub-elements in document order (depth
first pre-order).
Note that this also includes comments, entities and processing
instructions. To filter them out, check if the tag property
of the returned element is a string (i.e. not None and not a
factory function), or pass the Element factory for the tag
keyword.
If the optional tag argument is not None, the iterator returns only
the elements that match the respective name and namespace.
The optional boolean argument 'inclusive' defaults to True and can be set
to False to exclude the start element itself.
Note that the behaviour of this iterator is completely undefined if the
tree it traverses is modified during iteration.
|
__init__(self,
node,
tag=None,
inclusive=True)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
|
|
|
|
a new object with type S, a subtype of T
|
|
|
|
the next value, or raise StopIteration
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|
Inherited from object :
__class__
|
__init__(self,
node,
tag=None,
inclusive=True)
(Constructor)
|
|
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- Overrides:
object.__init__
|
- Returns: a new object with type S, a subtype of T
- Overrides:
object.__new__
|