AW: Work with xmlparse and dict_list

"Dr. Frank Hoffmann" <[email protected]> Mon, 1 Feb 2010 18:47:19 +0100
Newsgroups gmane.comp.cms.zms.devel
Message-ID <18D63502BC2A4012B7E5670D5643EC34@hal1>
Hello,
Your are right: the XML mapping functions the ZMS API is providing are
rather "low end", because ZMS uses this funtions primarily for ex/importing
XML config files and ZMS document tree.
For XML content processing there are a lot of python modules which can be
intergrated as product (eg ParsedXML) or via External Method (eg minidom
module). So, if you want to be more flexible try one of these extensions.

Best regards
fh, moderator




-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]]
Im Auftrag von Sebastian Tänzer
Gesendet: Montag, 1. Februar 2010 01:17
An: [email protected]
Betreff: [zms-developers] Work with xmlparse and dict_list

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

------------------------------------

Yahoo! Groups Links