File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 77
88from __future__ import absolute_import
99
10+ import re
1011from lxml import etree
1112
1213from .ns import NamespacePrefixedTag , nsmap
1819oxml_parser .set_element_class_lookup (element_class_lookup )
1920
2021
22+ def remove_hyperlink_tags (xml ):
23+ xml = xml .replace ("</w:hyperlink>" ,"" )
24+ xml = re .sub ('<w:hyperlink[^>]*>' ,"" ,xml )
25+ return xml
26+
27+
2128def parse_xml (xml ):
2229 """
2330 Return root lxml element obtained by parsing XML character string in
2431 *xml*, which can be either a Python 2.x string or unicode. The custom
2532 parser is used, so custom element classes are produced for elements in
2633 *xml* that have them.
2734 """
28- root_element = etree .fromstring (xml , oxml_parser )
35+ root_element = etree .fromstring (remove_hyperlink_tags ( xml ) , oxml_parser )
2936 return root_element
3037
3138
You can’t perform that action at this time.
0 commit comments