(xml: str, validate: bool = False)
| 66 | |
| 67 | |
| 68 | def 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 | |
| 81 | def get_schema(): |
nothing calls this directly
no test coverage detected