aboutsummaryrefslogtreecommitdiff
path: root/mammoth/docx/xmlparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'mammoth/docx/xmlparser.py')
-rw-r--r--mammoth/docx/xmlparser.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/mammoth/docx/xmlparser.py b/mammoth/docx/xmlparser.py
index 43d5eb4..4e963db 100644
--- a/mammoth/docx/xmlparser.py
+++ b/mammoth/docx/xmlparser.py
@@ -1,9 +1,14 @@
-import collections
import xml.sax
+import cobble
-XmlElementBase = collections.namedtuple("XmlElement", ["name", "attributes", "children"])
-class XmlElement(XmlElementBase):
+
+@cobble.data
+class XmlElement(object):
+ name = cobble.field()
+ attributes = cobble.field()
+ children = cobble.field()
+
def find_child_or_null(self, name):
return self.find_child(name) or _null_xml_element
@@ -48,7 +53,9 @@ class NullXmlElement(object):
_null_xml_element = NullXmlElement()
-XmlText = collections.namedtuple("XmlText", ["value"])
+@cobble.data
+class XmlText(object):
+ value = cobble.field()
def element(name, attributes=None, children=None):