Converter¶
Version conversion between DA XML formats (2.0 through 3.3).
GAEBConverter¶
GAEBConverter
¶
Convert GAEB files between DA XML versions.
Wraps GAEBParser.parse() + GAEBWriter.write() with conversion
semantics and a detailed :class:ConversionReport.
Usage::
report = GAEBConverter.convert(
"old.D83", "new.X83",
target_version=SourceVersion.DA_XML_33,
)
print(f"Converted {report.items_converted} items")
for warning in report.fields_dropped:
print(f" Dropped: {warning}")
convert
staticmethod
¶
convert(source, output, target_version=DA_XML_33, target_phase=None, encoding='utf-8')
Convert a GAEB file to a different DA XML version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str | Path | bytes
|
Input file path or raw bytes. |
required |
output
|
str | Path
|
Output file path. |
required |
target_version
|
SourceVersion
|
Target DA XML version (default: 3.3). |
DA_XML_33
|
target_phase
|
ExchangePhase | None
|
Override exchange phase (default: keep original). |
None
|
encoding
|
str
|
XML encoding (default: utf-8). |
'utf-8'
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
ConversionReport
|
class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If target_version is not writable (e.g. GAEB_90). |
GAEBParseError
|
If the source file cannot be parsed. |
convert_bytes
staticmethod
¶
convert_bytes(source, target_version=DA_XML_33, target_phase=None, encoding='utf-8')
Convert a GAEB file and return the result as bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str | Path | bytes
|
Input file path or raw bytes. |
required |
target_version
|
SourceVersion
|
Target DA XML version (default: 3.3). |
DA_XML_33
|
target_phase
|
ExchangePhase | None
|
Override exchange phase (default: keep original). |
None
|
encoding
|
str
|
XML encoding (default: utf-8). |
'utf-8'
|
Returns:
| Type | Description |
|---|---|
tuple[bytes, ConversionReport]
|
Tuple of (converted_xml_bytes, ConversionReport). |
ConversionReport¶
ConversionReport
¶
Bases: BaseModel
Report generated after a GAEB version conversion.
is_same_family
property
¶
True when both versions are in the same language family (both 3.x or both 2.x).
Version Registry¶
VersionMeta
dataclass
¶
VersionMeta(namespace, version_tag, lang, supports_bim_guid=True, supports_attachments=True, supports_change_order=True, supports_long_text_cdata=True, unsupported_fields=tuple())
Metadata describing a specific GAEB DA XML version's output requirements.