Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand Down
4 changes: 4 additions & 0 deletions src/xml2db/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)")

Expand Down
2 changes: 2 additions & 0 deletions src/xml2db/table/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions tests/sample_models/orders/equivalent_xml/order1a.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<companyId>
<bic>JIDAZIO786DAZH</bic>
</companyId>
<extra>
<profileName>profile 1</profileName>
</extra>
</orderperson>
<item>
<product>
Expand Down
7 changes: 7 additions & 0 deletions tests/sample_models/orders/orders.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="Extra">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="contacttype">
<xs:sequence>
<xs:element name="name" type="bt:stringtype"/>
Expand All @@ -29,6 +35,7 @@
<xs:element name="phoneNumber" type="bt:stringtype" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="companyId" type="companyIdType" minOccurs="0" maxOccurs="1"/>
<xs:element name="coordinates" type="bt:CoordinatesListType" minOccurs="0"/>
<xs:element name="extra" type="Extra" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
Expand Down
2 changes: 2 additions & 0 deletions tests/sample_models/orders/orders_source_tree_version0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/sample_models/orders/orders_source_tree_version1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/sample_models/orders/orders_source_tree_version2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading