Skip to content
Snippets Groups Projects
Commit a0fd8d31 authored by Benedikt's avatar Benedikt
Browse files

fixes #13

parent a621b168
Branches
Tags
No related merge requests found
Pipeline #50736 passed
......@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "dccXMLJSONConv"
version = "3.0.0.dev5"
version = "3.0.0.dev6"
description = "Python module for converting XML DCC (https://www.ptb.de/dcc/) to JSON and vice versa"
authors = [{name = "Benedikt Seeger,Thomas Bruns, Vanessa Stehr", email = "benedikt.seeger@ptb.de"}]
license = {text = "LGPL-2.1-or-later"}
......
......@@ -103,7 +103,7 @@ class XMLSchemaConverter:
warnings.warn(f"XML->JSON Validation error: {e}. Attempting template insertion.")
#TODO add logic to find fragments root tag
root_tag = self._getRootElement(input_data)
templateName = self.templateMapping.get(root_tag, "default")
templateName = self.templateMapping.get(root_tag, "inData")
template_info=self.templates[templateName]
rendered_xml = self._load_jinja_template(template_info["template_path"] + '.xml', input_data)
conversion_result = self.schema.to_dict(rendered_xml, validation="lax")
......@@ -140,7 +140,7 @@ class XMLSchemaConverter:
#we will not handle this since the callee should have taken care of this
raise Exception("Multiple root elements in JSON. Cannot determine template")
root_tag=dictKeys[0]
templateName = self.templateMapping.get(root_tag, "default")
templateName = self.templateMapping.get(root_tag, "inData")
template_info=self.templates[templateName]
rendered_json = self._load_jinja_template(template_info["template_path"] + '.json', json.dumps(input_data))
rendered_dict = json.loads(rendered_json)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment