aboutsummaryrefslogtreecommitdiff
path: root/mammoth/docx/xmlparser.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-12-01 13:25:28 +0000
committerMichael Williamson <mike@zwobble.org>2013-12-01 13:25:28 +0000
commit8fc128a3e70465b82605b4c0bdb3d1a6ffe87ef6 (patch)
treeacecd2ed471a944c846a8b8ecf05138e182c594a /mammoth/docx/xmlparser.py
parent26f2353d42ddd4a87f6f9f56711495bd3799fc8d (diff)
Read numbering properties in paragraph properties
Diffstat (limited to 'mammoth/docx/xmlparser.py')
-rw-r--r--mammoth/docx/xmlparser.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/mammoth/docx/xmlparser.py b/mammoth/docx/xmlparser.py
index efeafcf..50c80db 100644
--- a/mammoth/docx/xmlparser.py
+++ b/mammoth/docx/xmlparser.py
@@ -5,10 +5,13 @@ import xml.sax
XmlElementBase = collections.namedtuple("XmlElement", ["name", "attributes", "children"])
class XmlElement(XmlElementBase):
def find_child_or_null(self, name):
+ return self.find_child(name) or _null_xml_element
+
+ def find_child(self, name):
for child in self.children:
if child.name == name:
return child
- return _null_xml_element
+
def find_children(self, name):
return filter(lambda child: child.name == name, self.children)
@@ -19,6 +22,9 @@ class NullXmlElement(object):
def find_child_or_null(self, name):
return self
+
+ def find_child(self, name):
+ return None
_null_xml_element = NullXmlElement()