diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-12-01 21:21:14 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-12-01 21:21:14 +0000 |
| commit | 9b479955a7c5b0547db8b274d2dfd6d0d6152194 (patch) | |
| tree | 9e625825b2749853d9db63c42fbaa45772331eb4 /mammoth/docx/xmlparser.py | |
| parent | 4d26fc0b174beccd0129220de74fe0b44c6c7edf (diff) | |
Read inline images
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): |
