[Chicago] xml to py object

Kumar McMillan kumar.mcmillan at gmail.com
Fri May 1 16:27:52 CEST 2009


On Fri, May 1, 2009 at 8:34 AM, Lukasz Szybalski <szybalski at gmail.com> wrote:
> Hello,
> I'm trying to convert an xml to python like object where:
>
>      <ClientApp>
>            <Org>my company</Org>
>             <Name>Full name of the comapny</Name>
>            <Version>1.02 (4.02)</Version>
>        </ClientApp>
>
> would correspond to
>
> class someobject(object):........
>
> and would be accessible via something like:
>
> print x.ClientApp.Org
> print x.ClientApp.Name
> print x.ClientApp.Version
>
> Not sure how things like this would be implemented:
>
>  <Vehicle id="Veh_1" LocationRef="Location_1" DriverRef="Driver_1"/>
>
> Is there a module/library that is able convert the xml into something like this?

lxml.objectify might do what you want:
http://codespeak.net/lxml/objectify.html


>
> Thanks,
> Lucas
>
>
> --
> How to create python package?
> http://lucasmanual.com/mywiki/PythonPaste
> DataHub - create a package that gets, parses, loads, visualizes data
> http://lucasmanual.com/mywiki/DataHub
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>


More information about the Chicago mailing list