Writer & Export¶
Write GAEB DA XML files and export to JSON/CSV.
GAEBWriter¶
GAEBWriter
¶
Write a GAEBDocument to a DA XML file.
Usage::
GAEBWriter.write(doc, "output.X84", phase=ExchangePhase.X84)
GAEBWriter.write(doc, "legacy.D83", target_version=SourceVersion.DA_XML_20)
write
staticmethod
¶
write(doc, path, phase=None, target_version=DA_XML_33, encoding='utf-8')
Serialize a GAEBDocument to a GAEB DA XML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc
|
GAEBDocument
|
The document to serialize. |
required |
path
|
str | Path
|
Output file path. |
required |
phase
|
ExchangePhase | None
|
Override exchange phase (default: keep original). |
None
|
target_version
|
SourceVersion
|
Target DA XML version (default: 3.3). |
DA_XML_33
|
encoding
|
str
|
XML encoding declaration (default: utf-8). |
'utf-8'
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of warnings about fields dropped for the target version. |
JSON Export¶
to_json
¶
Export a GAEBDocument to a JSON file.
By default, binary attachment data is stripped (metadata kept). Pass include_attachments=True to include base64-encoded data.
to_json_string
¶
Export a GAEBDocument to a JSON string.
CSV Export¶
to_csv
¶
Export all items as a flat CSV file.
Includes classification columns (trade, element_type, etc.) if items
have been classified. Attachments are never included — only a boolean
has_attachments column.