mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-19 22:12:03 +02:00
17.0 vanilla
This commit is contained in:
parent
2e65bf056a
commit
df627a6bba
328 changed files with 578149 additions and 759311 deletions
|
|
@ -140,7 +140,8 @@ def cleanup_xml_node(xml_node_or_string, remove_blank_text=True, remove_blank_no
|
|||
if isinstance(xml_node, str):
|
||||
xml_node = xml_node.encode() # misnomer: fromstring actually reads bytes
|
||||
if isinstance(xml_node, bytes):
|
||||
xml_node = etree.fromstring(remove_control_characters(xml_node))
|
||||
parser = etree.XMLParser(recover=True, resolve_entities=False)
|
||||
xml_node = etree.fromstring(remove_control_characters(xml_node), parser=parser)
|
||||
|
||||
# Process leaf nodes iteratively
|
||||
# Depth-first, so any inner node may become a leaf too (if children are removed)
|
||||
|
|
@ -302,3 +303,8 @@ def validate_xml_from_attachment(env, xml_content, xsd_name, reload_files_functi
|
|||
_logger.info("XSD validation successful!")
|
||||
except FileNotFoundError:
|
||||
_logger.info("XSD file not found, skipping validation")
|
||||
|
||||
|
||||
def find_xml_value(xpath, xml_element, namespaces=None):
|
||||
element = xml_element.xpath(xpath, namespaces=namespaces)
|
||||
return element[0].text if element else None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue