diff options
Diffstat (limited to 'mammoth/docx/xmlparser.py')
| -rw-r--r-- | mammoth/docx/xmlparser.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/mammoth/docx/xmlparser.py b/mammoth/docx/xmlparser.py index 50c80db..74d8730 100644 --- a/mammoth/docx/xmlparser.py +++ b/mammoth/docx/xmlparser.py @@ -14,7 +14,22 @@ class XmlElement(XmlElementBase): def find_children(self, name): - return filter(lambda child: child.name == name, self.children) + return XmlElementList(filter(lambda child: child.name == name, self.children)) + + +class XmlElementList(object): + def __init__(self, elements): + self._elements = elements + + def __iter__(self): + return iter(self._elements) + + def find_children(self, name): + children = [] + for element in self._elements: + for child in element.find_children(name): + children.append(child) + return XmlElementList(children) class NullXmlElement(object): |
