amal.eda.ipxact_de package
Subpackages
Submodules
amal.eda.ipxact_de.xml_document module
XML parsing utilities for IP-XACT / SPIRIT documents.
- class amal.eda.ipxact_de.xml_document.XmlDocument(path, *, auto_parse=True)
Bases:
object
Represents a parsed IP-XACT/SPIRIT XML document.
Attributes
- path: Path
Path to the original XML file.
- tree: etree._ElementTree | None
Parsed XML tree (None until parsing succeeds).
- schema: str | None
Resolved schema location (index.xsd path) if discovered.
- version: str | None
Version string in the form ‘IPXACT/1685-2022’ or ‘SPIRIT/1.5’.
- root_name: str | None
Root element name.
- is_spirit: bool
True if the file namespace matches SPIRIT.
- is_ipxact: bool
True if the file namespace matches IP-XACT.
- classmethod deserialize(xml, cls_type)
Deserialize
xml
string into an instance ofcls_type
.Parameters
- xml: str
XML text to parse.
- cls_type: type[T]
Target dataclass type.
Returns
- T
The deserialized object instance.
- Parameters:
xml (str)
cls_type (type[T])
- Return type:
T
- parse()
Parse the XML document if not already parsed.
This populates tree, schema, standard, version, root_name, and flags. Subsequent calls are no-ops.
- Return type:
None
- classmethod parser()
Return a shared
XmlParser
instance.Returns
- XmlParser
The singleton parser bound to the shared XML context.
- Return type:
XmlParser
- Parameters:
path (Path)
auto_parse (bool)