Work with xmlparse and dict_list
Sebastian Tänzer <[email protected]> Mon, 1 Feb 2010 01:17:26 +0100
| Newsgroups | gmane.comp.cms.zms.devel |
|---|---|
| Message-ID | <[email protected]> |
Dear ZMS-Users, does anyone of you know of a faster and more convient way to retrieve data from a large XML file: xml_data = ob['data'] xml = ZMS.xmlParse(xml_data) filtered_xml = ZMS.xmlNodeSet(xml,'immobilie',True) for i in filtered_xml: weitere_adresse = ZMS.dict_list(i['tags'])['weitere_adresse']['tags'] try: weitere_adresse_ort = ZMS.dict_list(weitere_adresse)['ort']['cdata'] except: weitere_adresse_ort = False ? Especially the part checking for the existance of the node is quite "ugly". The data is real estate objects with about 250 properties but not every object has the same properties. A simple "if xyz in.." works, too, but isn't really shorter. Sincerely, Sebastian - tänzermedien e.K. - Agentur für Online-Medien E-Mail: [email protected] Web: http://www.taenzer.me Tel.: 0228-304134-0 Fax.: 0228-304134-99 Kekuléstr. 39, 53115 Bonn, Germany