From 2840f569c01b5fa66304219885c12d907c194398 Mon Sep 17 00:00:00 2001 From: Kay Robbins <1189050+VisLab@users.noreply.github.com> Date: Wed, 9 Apr 2025 13:55:08 -0500 Subject: [PATCH] Fixed xml2schema extras input --- hed/schema/schema_io/wiki2schema.py | 2 +- hed/schema/schema_io/xml2schema.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hed/schema/schema_io/wiki2schema.py b/hed/schema/schema_io/wiki2schema.py index 0cd4ef240..9a19daa67 100644 --- a/hed/schema/schema_io/wiki2schema.py +++ b/hed/schema/schema_io/wiki2schema.py @@ -120,7 +120,7 @@ def _parse_extras(self, wiki_lines_by_section): if not data: continue df = pd.DataFrame(data).fillna('').astype(str) - self._schema.extras[extra_key] = df + self._schema.extras[extra_key.strip('"')] = df @staticmethod def parse_star_string(s): diff --git a/hed/schema/schema_io/xml2schema.py b/hed/schema/schema_io/xml2schema.py index 743e353cd..14a0abb41 100644 --- a/hed/schema/schema_io/xml2schema.py +++ b/hed/schema/schema_io/xml2schema.py @@ -240,11 +240,13 @@ def _get_element_tag_value(self, element, tag_name=xml_constants.NAME_ELEMENT): return element.text return "" - def _get_element_value(self, element, tag_name): - if element is None or element.text is None: + @staticmethod + def _get_element_value(element, tag_name): + this_element = element.find(tag_name) + if this_element is None or this_element.text is None: return '' else: - return element.text + return this_element.text def _get_elements_by_name(self, element_name='node', parent_element=None): """ Get the elements that have a specific element name.