Project

General

Profile

« Previous | Next » 

Revision 4238

xml_dom.py: Added NodeEntryIter

View differences:

lib/xml_dom.py
139 139

  
140 140
def last_elem(node): return NodeElemReverseIter(node).next()
141 141

  
142
class NodeEntryIter:
143
    def __init__(self, node): self.iter_ = NodeElemIter(node)
144
    
145
    def __iter__(self): return self
146
    
147
    def next(self):
148
        entry = self.iter_.next()
149
        if is_empty(entry): value = None
150
        else:
151
            assert has_one_child(entry) # TODO: convert to an exception
152
            value = entry.firstChild
153
        return (entry.tagName, value)
154

  
142 155
##### Parent nodes
143 156

  
144 157
def parent(node):

Also available in: Unified diff