diff --git a/easyDataverse/dataverse.py b/easyDataverse/dataverse.py index 89473d4..a0c9104 100644 --- a/easyDataverse/dataverse.py +++ b/easyDataverse/dataverse.py @@ -479,13 +479,19 @@ def _extract_data(self, fields: List, tree: Node): data = {} for field in fields: - node = findall_by_attr(tree, field.typeName, "typeName")[0] - name = node.name - dvtype = node.typeClass + result = findall_by_attr(tree, field.typeName, "typeName") - if dvtype.lower() == "compound": - data[name] = self._process_compound(field.value, tree) + if len(result) > 0: + node = result[0] + name = node.name + dvtype = node.typeClass + + if dvtype.lower() == "compound": + data[name] = self._process_compound(field.value, tree) + else: + data[name] = field.value else: + name = field.typeName data[name] = field.value return data