<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18904"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#008000 size=2 face=Arial><SPAN
class=308350207-12052010>Thanks to all - Just to give a positive feed
back.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#008000 size=2 face=Arial><SPAN
class=308350207-12052010>The following solution works for
me:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#008000 size=2 face=Arial><SPAN
class=308350207-12052010></SPAN></FONT> </DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr>
<DIV dir=ltr align=left><SPAN class=308350207-12052010>
<P><FONT size=2 face=Arial>from</FONT><FONT face=Arial><FONT size=2>
xml.etree.ElementTree import ElementTree</FONT></P></FONT>
<P align=left><FONT size=2 face=Arial>tree = ElementTree()</FONT></P>
<P align=left><FONT size=2 face=Arial>tree.parse(<SPAN
class=308350207-12052010>'</SPAN><SPAN
class=308350207-12052010>inifile.xml'</SPAN>)</FONT></P>
<P align=left><FONT size=2><FONT face=Arial>dicIni = dict((child.tag,
child.text) </FONT><FONT face=Arial>for child in
tree.getroot().getchildren())</FONT></FONT></P></DIV></BLOCKQUOTE>
<P dir=ltr align=left><SPAN class=308350207-12052010><FONT color=#008000 size=2
face=Arial>:-) Martin</FONT></SPAN></P>
<DIV style="MARGIN-RIGHT: 0px" dir=ltr align=left><FONT
color=#008000></FONT></SPAN> </DIV>
<DIV><FONT color=#008000 size=2 face=Arial></FONT> </DIV>
<DIV align=center><FONT color=#008000><STRONG><FONT size=2 face=Arial>This email
is made of 100% recycled bytes </FONT></STRONG><STRONG><FONT size=2
face=Arial>...</FONT></STRONG></FONT></DIV>
<DIV> </DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Hvidberg, Martin <BR><B>Sent:</B> Tuesday,
May 11, 2010 2:54 PM<BR><B>To:</B> 'python-list@python.org'<BR><B>Subject:</B>
reading xml from python<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2 face=Arial>I'm
looking for at way to read (and later write) small simple .xml file from
Python.</FONT></SPAN></DIV>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2 face=Arial>e.g. I
would like to read the following from a small ini.xml file into a
dictionary.</FONT></SPAN></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2
face=Arial><?xml version="1.0" encoding="UTF-8"?></FONT></SPAN></DIV>
<DIV><SPAN class=022394812-11052010></SPAN><SPAN
class=022394812-11052010><FONT color=#008000 size=2
face=Arial><initialisation><BR> <idrectory>default</idrectory></FONT></SPAN></DIV>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2
face=Arial> <nosplit>False</nosplit><BR> <nobatch>False</nobatch><BR> <ubmmode>UBMlight</ubmmode></FONT></SPAN></DIV>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2
face=Arial> <overwrite_output>True</overwrite_output><BR></initialisation><BR></FONT></SPAN></DIV></BLOCKQUOTE>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2 face=Arial>I
would prefer a relative simple (not too much creating new classes) way to do
this.</FONT></SPAN></DIV>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2 face=Arial>Any
suggestions appreciated.</FONT></SPAN></DIV>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=022394812-11052010><FONT color=#008000 size=2 face=Arial>:-)
Martin</DIV></FONT></SPAN></BODY></HTML>