From 9b479955a7c5b0547db8b274d2dfd6d0d6152194 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 1 Dec 2013 21:21:14 +0000 Subject: Read inline images --- mammoth/docx/xmlparser.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'mammoth/docx/xmlparser.py') 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): -- cgit v1.2.3