[BangPypers] Access xml file form python script

Noufal Ibrahim noufal at gmail.com
Sun Oct 31 14:17:40 CET 2010


On Sun, Oct 31 2010, Avinash TM wrote:

> Hi All,
>
> I have created a simple xml document i.e., preferences.xml as follows
>
> <?xml version="1.0"?>
> <object>
>   <object name="category" value="cricket">
>    <property name="title">Cricket</property>
>    <property name="subscribers">
>     <element name="avinash"/>
> <element name="prashant"/>
>    </property>
>   </object>
> </object>

[...]

The elementree module can help you parse this. Docs available here
http://docs.python.org/library/xml.etree.elementtree.html

However, this looks like configuration options of some kind so you might
be better off using the .ini file format and ConfigParser module 
http://docs.python.org/library/configparser.html



-- 
~noufal
http://nibrahim.net.in


More information about the BangPypers mailing list