def preprocess_xml_diff(self, root): """ Run pre-processing on XML before doing HTML diffs. This removes <term> elements. """ for elem in root.xpath('//a:term', namespaces={'a': root.nsmap[None]}): unwrap_element(elem) return root
def preprocess_document_diff(self, xml_str): """ Run pre-processing on XML before doing HTML diffs. This removes <term> elements. """ root = etree.fromstring(xml_str) for elem in root.xpath('//a:term', namespaces={'a': root.nsmap[None]}): unwrap_element(elem) return etree.tostring(root, encoding='utf-8')