[lxml-dev] newb: How to create a simple xml file?

Stefan Behnel stefan_ml at behnel.de
Thu Mar 29 09:26:25 CEST 2007


Ram Peters wrote:
> How to create a simple xml file like the one below in lxml?
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <weatherNow xmlns="http://example.com/weatherNow/">
> <temperature>57</temperature>
> <pressure>29.97</pressure>
> <pressureChange>rising</pressureChange>
> </weatherNow>

Hi,

what about reading some of the documentation?

http://codespeak.net/lxml/#documentation

Given your target XML above (which is data style, not document style XML), you
might especially be interested in the objectify API.

http://codespeak.net/lxml/objectify.html
http://codespeak.net/lxml/objectify.html#creating-objectify-trees

Hope it helps,
Stefan


More information about the lxml-dev mailing list