From 60719344aafe19e9b0cd02f61d4e9e7308687545 Mon Sep 17 00:00:00 2001 From: Sebastian Heppner Date: Wed, 15 Nov 2023 09:46:42 +0100 Subject: [PATCH] adapter.xml: Fix deserialization for `Extension` Currently, the XML deserialization missed the `` wrapper around the single references inside `Extension.refers_to`. This commit fixes that. --- basyx/aas/adapter/xml/xml_deserialization.py | 6 ++++-- .../test_demo_full_example_wrong_attribute.xml | 14 ++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/basyx/aas/adapter/xml/xml_deserialization.py b/basyx/aas/adapter/xml/xml_deserialization.py index a2acc55a2..abc737b2f 100644 --- a/basyx/aas/adapter/xml/xml_deserialization.py +++ b/basyx/aas/adapter/xml/xml_deserialization.py @@ -692,8 +692,10 @@ def construct_extension(cls, element: etree.Element, object_class=model.Extensio value = _get_text_or_none(element.find(NS_AAS + "value")) if value is not None: extension.value = model.datatypes.from_xsd(value, extension.value_type) - extension.refers_to = _failsafe_construct_multiple(element.findall(NS_AAS + "refersTo"), - cls._construct_referable_reference, cls.failsafe) + extension.refers_to = _failsafe_construct_multiple( + element.find(NS_AAS + "refersTo").findall(NS_AAS + "reference"), + cls._construct_referable_reference, cls.failsafe + ) cls._amend_abstract_attributes(extension, element) return extension diff --git a/test/compliance_tool/files/test_demo_full_example_wrong_attribute.xml b/test/compliance_tool/files/test_demo_full_example_wrong_attribute.xml index ca5cd879d..061ee58b6 100644 --- a/test/compliance_tool/files/test_demo_full_example_wrong_attribute.xml +++ b/test/compliance_tool/files/test_demo_full_example_wrong_attribute.xml @@ -347,13 +347,15 @@ xs:string ExampleExtensionValue + ModelReference - - - AssetAdministrationShell - http://acplt.org/RefersTo/ExampleRefersTo - - + + + AssetAdministrationShell + http://acplt.org/RefersTo/ExampleRefersTo + + +