Skip to content

Commit 799a2e6

Browse files
authored
Removal of lang_string_set_to_xml (dead code) (#457)
Previously, the serialization of `adapter.xml` uses the general `object_to_xml_element()` method. In it, there was branch to a call of `lang_string_set_to_xml()` without setting the tag parameter, which would have caused an exception, if the code was ever run. We decided to remove the call of `lang_string_set_to_xml` completely as this specific case in `object_to_xml()` is considered dead code, as the XML tag for a `LangStringSet` varies based on its context (the tag is determined by the *parent's* attribute), it must always be called explicitly with a tag parameter by the *parent's serialization logic*. Since there is no scenario where a `LangStringSet` is serialized in isolation (It **cannot** be a standalone xml object), this branch is unreachable and should be removed to maintain code cleanliness. Fixes #397
1 parent aeb1b78 commit 799a2e6

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

sdk/basyx/aas/adapter/xml/xml_serialization.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2025 the Eclipse BaSyx Authors
1+
# Copyright (c) 2026 the Eclipse BaSyx Authors
22
#
33
# This program and the accompanying materials are made available under the terms of the MIT License, available in
44
# the LICENSE file of this project.
@@ -899,10 +899,6 @@ def object_to_xml_element(obj: object) -> etree._Element:
899899
return value_reference_pair_to_xml(obj)
900900
elif isinstance(obj, model.ConceptDescription):
901901
return concept_description_to_xml(obj)
902-
elif isinstance(obj, model.LangStringSet):
903-
# FIXME: `lang_string_set_to_xml` expects `tag` parameter, `tag` doesn't have default value
904-
# Issue: https://github.com/eclipse-basyx/basyx-python-sdk/issues/397
905-
return lang_string_set_to_xml(obj) # type: ignore[call-arg]
906902
elif isinstance(obj, model.EmbeddedDataSpecification):
907903
return embedded_data_specification_to_xml(obj)
908904
elif isinstance(obj, model.DataSpecificationIEC61360):

0 commit comments

Comments
 (0)