NOTICE: All information contained herein is, and remains
the property of TechnoCore Automate.
The ObjImportApi class in ObjDataImportXml.py imports data from XML files
structured as a flat list of sibling record elements under a root container.
Both element attributes and child-element text content are captured as columns.
The column list is the union of all attribute names and child-element tags found
across every record, preserving insertion order.
Uses stdlib xml.etree.ElementTree — no third-party dependency.
prep_file(filename) -> strNo-op — returns the filename unchanged.
open_file(filename)Parses the full XML file. Auto-detects the record element tag from the first
child of root unless self.row_tag is set explicitly before calling.
close_file()Releases the in-memory record list.
column_list() -> listReturns the union of all attribute and child-element names across all records.
next_row() -> list | strReturns the next record as a list of string values in column order. Fields
absent from a record are returned as "". Returns "EOF" when exhausted.
| Attribute | Default | Purpose |
|---|---|---|
row_tag |
"" (auto) |
Override the record element tag name |
<records>
<record id="1"><name>Alice</name><score>95</score></record>
<record id="2"><name>Bob</name><score>82</score></record>
</records>
Attributes and child elements can be freely mixed on the same record element.
importer = ObjImportApi()
importer.open_file("feed.xml")
columns = importer.column_list()
while True:
row = importer.next_row()
if row == "EOF":
break
print(dict(zip(columns, row)))
importer.close_file()
Updated : 2026-03-13