MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / from_string

Function from_string

src/ifctester/ifctester/ids.py:68–78  ·  view source on GitHub ↗
(xml: str, validate: bool = False)

Source from the content-addressed store, hash-verified

66
67
68def from_string(xml: str, validate: bool = False) -> Ids:
69 tree = ET.ElementTree(ET.fromstring(xml))
70 try:
71 if validate:
72 get_schema().validate(tree)
73 decode = get_schema().decode(
74 xml, strip_namespaces=True, namespaces={"": "http://standards.buildingsmart.org/IDS"}
75 )
76 except XMLSchemaValidationError as e:
77 raise IdsXmlValidationError(e, "Provided XML appears to be invalid. See details above.")
78 return Ids().parse(decode)
79
80
81def get_schema():

Callers

nothing calls this directly

Calls 6

get_schemaFunction · 0.85
IdsClass · 0.85
validateMethod · 0.45
decodeMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected