self.parents = []
def __iter__(self):
return self
- def __next__(self):
+ def next(self):
while 1:
if self.node:
ret = self.node
except IndexError:
raise StopIteration
self.node = parent.next
- next = __next__
#
# implements the breadth-first iterator for libxml2 DOM tree
self.parents = []
def __iter__(self):
return self
- def __next__(self):
+ def next(self):
while 1:
if self.node:
ret = self.node
except IndexError:
raise StopIteration
self.node = parent.children
- next = __next__
#
# converters to present a nicer view of the XPath returns
def newNs(self, href, prefix):
"""Creation of a new Namespace. This function will refuse to
create a namespace with a similar prefix than an existing
- one present on this node. Note that for a default
- namespace, @prefix should be None. We use href==None in
- the case of an element creation where the namespace was not
- defined. """
+ one present on this node. We use href==None in the case of
+ an element creation where the namespace was not defined. """
ret = libxml2mod.xmlNewNs(self._o, href, prefix)
if ret is None:raise treeError('xmlNewNs() failed')
__tmp = xmlNs(_obj=ret)