<incident report_id=" gdate="aircraft_id=" aircraft_type="ce- -mpilot_percent_hours_on_type=" pilot_total_hours=" midair=" "bowerman on go-around from night crosswind landing attempt the aircraft hit runway edge light damaging one propeller figure an example xml format aircraft incident record in context treedomand sax parsers if you don' care which approach is used to read or write the xmlyou could just read the element trees subsection that followsand then skip to the final section (random access binary files element trees |writing the data using an element tree is done in two phasesfirst an element tree representing the data must be createdand second the tree must be written to file some programs might use the element tree as their data structurein which case they already have the tree and can simply write out the data we will look at the export_xml_etree(method in two partsdef export_xml_etree(selffilename)root xml etree elementtree element("incidents"for incident in self values()element xml etree elementtree element("incident"report_id=incident report_iddate=incident date isoformat()aircraft_id=incident aircraft_idaircraft_type=incident aircraft_typepilot_percent_hours_on_type=strincident pilot_percent_hours_on_type)pilot_total_hours=str(incident pilot_total_hours)