Browse Source

Encode XML content to bytes if neccessary.

Stan Janssen 4 years ago
parent
commit
728d2cd18e
1 changed files with 2 additions and 0 deletions
  1. 2 0
      openleadr/messaging.py

+ 2 - 0
openleadr/messaging.py

@@ -86,6 +86,8 @@ def validate_xml_schema(content):
     """
     Validates the XML tree against the schema. Return the XML tree.
     """
+    if isinstance(content, str):
+        content = content.encode('utf-8')
     tree = etree.fromstring(content, XML_PARSER)
     return tree