Fix bug in IfcTester thanks to Sayan where parsing XML text using ET would expand namespaces and therefore break namespaces during decode

This commit is contained in:
Dion Moult
2025-07-16 17:47:33 +10:00
parent 866362c6ed
commit 4a9cf433d1
+1 -2
View File
@@ -63,12 +63,11 @@ def open(filepath: str, validate: bool = False) -> Ids:
def from_string(xml: str, validate: bool = False) -> Ids:
tree = ET.ElementTree(ET.fromstring(xml))
try:
if validate:
get_schema().validate(tree)
decode = get_schema().decode(
tree, strip_namespaces=True, namespaces={"": "http://standards.buildingsmart.org/IDS"}
xml, strip_namespaces=True, namespaces={"": "http://standards.buildingsmart.org/IDS"}
)
except XMLSchemaValidationError as e:
raise IdsXmlValidationError(e, "Provided XML appears to be invalid. See details above.")