From 0c2b27584db910ab0fe7db5b9738b16f8e6a80ef Mon Sep 17 00:00:00 2001 From: Vuong Quoc Binh Date: Tue, 16 Oct 2018 15:13:25 +0700 Subject: [PATCH] Fix invalid xml --- docxtpl/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docxtpl/__init__.py b/docxtpl/__init__.py index 41d38dc..09ff4ca 100644 --- a/docxtpl/__init__.py +++ b/docxtpl/__init__.py @@ -189,7 +189,8 @@ class DocxTemplate(object): # using of TC tag in for cycle can cause that count of columns does not correspond to # real count of columns in row. This function is able to fix it. def fix_tables(self, xml): - tree = etree.fromstring(xml) + parser = etree.XMLParser(recover=True) + tree = etree.fromstring(xml, parser=parser) # get namespace ns = '{' + tree.nsmap['w'] + '}' # walk trough xml and find table