Skip to content

Commit b1f33b6

Browse files
author
Steve Canny
committed
fix: a couple small fixes
1 parent e8fb68e commit b1f33b6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

docx/opc/oxml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# configure XML parser
1818
element_class_lookup = etree.ElementNamespaceClassLookup()
19-
oxml_parser = etree.XMLParser(remove_blank_text=True)
19+
oxml_parser = etree.XMLParser(remove_blank_text=True, resolve_entities=False)
2020
oxml_parser.set_element_class_lookup(element_class_lookup)
2121

2222
nsmap = {

docx/oxml/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# configure XML parser
1616
element_class_lookup = etree.ElementNamespaceClassLookup()
17-
oxml_parser = etree.XMLParser(remove_blank_text=True)
17+
oxml_parser = etree.XMLParser(remove_blank_text=True, resolve_entities=False)
1818
oxml_parser.set_element_class_lookup(element_class_lookup)
1919

2020

docx/oxml/table.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ def _tbl(self):
651651
"""
652652
The tbl element this tc element appears in.
653653
"""
654-
return self.xpath('./ancestor::w:tbl')[0]
654+
return self.xpath('./ancestor::w:tbl[position()=1]')[0]
655655

656656
@property
657657
def _tc_above(self):
@@ -675,7 +675,7 @@ def _tr(self):
675675
"""
676676
The tr element this tc element appears in.
677677
"""
678-
return self.xpath('./ancestor::w:tr')[0]
678+
return self.xpath('./ancestor::w:tr[position()=1]')[0]
679679

680680
@property
681681
def _tr_above(self):

0 commit comments

Comments
 (0)