[BangPypers] Access xml file form python script

Sujit Ghosal thesujit at gmail.com
Sun Oct 31 14:29:24 CET 2010


Hi Avinash,
    Expat module can be used to fetch the elements out of the XML document.

Hope that helps.

- Sujit

On Sun, Oct 31, 2010 at 6:47 PM, Noufal Ibrahim <noufal at gmail.com> wrote:

> 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
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list