mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 01:11:40 +00:00
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:
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user