diff --git a/pyproject.toml b/pyproject.toml index 6360f7f..7d38d7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "xml2db" -version = "0.12.5" +version = "0.12.6" authors = [ { name="Commission de régulation de l'énergie", email="opensource@cre.fr" }, ] diff --git a/src/xml2db/model.py b/src/xml2db/model.py index fd666d4..6d5b9fb 100644 --- a/src/xml2db/model.py +++ b/src/xml2db/model.py @@ -537,6 +537,10 @@ def get_occurs(particle): ) else: raise ValueError("unknown case; please check") + elif type(child) is xmlschema.validators.wildcards.XsdAnyElement: + logger.warning( + f"type '{parent_type}' contains a xsd:any child, which is ignored" + ) else: raise ValueError("unknown case; please check (child not an XsdElement)") diff --git a/src/xml2db/table/column.py b/src/xml2db/table/column.py index 17daba6..3b78577 100644 --- a/src/xml2db/table/column.py +++ b/src/xml2db/table/column.py @@ -210,6 +210,8 @@ def can_join_values_as_string(self): "dateTime", "NMTOKEN", "time", + "base64Binary", # was added as a fix for accepting more schemas, but not ideal + "decimal", # was added as a fix for accepting more schemas, but not ideal ): return True raise ValueError( diff --git a/tests/sample_models/orders/equivalent_xml/order1a.xml b/tests/sample_models/orders/equivalent_xml/order1a.xml index 481996e..7a6f7c1 100644 --- a/tests/sample_models/orders/equivalent_xml/order1a.xml +++ b/tests/sample_models/orders/equivalent_xml/order1a.xml @@ -13,6 +13,9 @@ JIDAZIO786DAZH + + profile 1 + diff --git a/tests/sample_models/orders/orders.xsd b/tests/sample_models/orders/orders.xsd index 4fa2801..68914ae 100644 --- a/tests/sample_models/orders/orders.xsd +++ b/tests/sample_models/orders/orders.xsd @@ -19,6 +19,12 @@ + + + + + + @@ -29,6 +35,7 @@ + diff --git a/tests/sample_models/orders/orders_source_tree_version0.txt b/tests/sample_models/orders/orders_source_tree_version0.txt index af4280e..a5004db 100644 --- a/tests/sample_models/orders/orders_source_tree_version0.txt +++ b/tests/sample_models/orders/orders_source_tree_version0.txt @@ -20,6 +20,7 @@ orders: bic[0, 1]: string lei[0, 1]: string coordinates[0, 1]: string + extra[0, 1]: shipto[0, 1]: name_attr[0, 1]: string name[1, 1]: string @@ -36,6 +37,7 @@ orders: bic[0, 1]: string lei[0, 1]: string coordinates[0, 1]: string + extra[0, 1]: item[1, None]: product[1, 1]: name[1, 1]: string diff --git a/tests/sample_models/orders/orders_source_tree_version1.txt b/tests/sample_models/orders/orders_source_tree_version1.txt index af4280e..a5004db 100644 --- a/tests/sample_models/orders/orders_source_tree_version1.txt +++ b/tests/sample_models/orders/orders_source_tree_version1.txt @@ -20,6 +20,7 @@ orders: bic[0, 1]: string lei[0, 1]: string coordinates[0, 1]: string + extra[0, 1]: shipto[0, 1]: name_attr[0, 1]: string name[1, 1]: string @@ -36,6 +37,7 @@ orders: bic[0, 1]: string lei[0, 1]: string coordinates[0, 1]: string + extra[0, 1]: item[1, None]: product[1, 1]: name[1, 1]: string diff --git a/tests/sample_models/orders/orders_source_tree_version2.txt b/tests/sample_models/orders/orders_source_tree_version2.txt index af4280e..a5004db 100644 --- a/tests/sample_models/orders/orders_source_tree_version2.txt +++ b/tests/sample_models/orders/orders_source_tree_version2.txt @@ -20,6 +20,7 @@ orders: bic[0, 1]: string lei[0, 1]: string coordinates[0, 1]: string + extra[0, 1]: shipto[0, 1]: name_attr[0, 1]: string name[1, 1]: string @@ -36,6 +37,7 @@ orders: bic[0, 1]: string lei[0, 1]: string coordinates[0, 1]: string + extra[0, 1]: item[1, None]: product[1, 1]: name[1, 1]: string