mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +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:
|
def from_string(xml: str, validate: bool = False) -> Ids:
|
||||||
tree = ET.ElementTree(ET.fromstring(xml))
|
|
||||||
try:
|
try:
|
||||||
if validate:
|
if validate:
|
||||||
get_schema().validate(tree)
|
get_schema().validate(tree)
|
||||||
decode = get_schema().decode(
|
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:
|
except XMLSchemaValidationError as e:
|
||||||
raise IdsXmlValidationError(e, "Provided XML appears to be invalid. See details above.")
|
raise IdsXmlValidationError(e, "Provided XML appears to be invalid. See details above.")
|
||||||
|
|||||||
Reference in New Issue
Block a user