newb: lxml objectify

johnny rampeters at
Fri Mar 30 22:36:30 CEST 2007

<DVD id="1">
<title>Breakfast at Tiffany's</title>

<DVD id="2">

How do you represent DVD id=1 and it's elements, and DVD id=2 and it's
elements as child of root "Library"?
Like this:?

from lxml import etree
from lxml import objectify

root = objectify.Element("Library")
child[1] = objectify.Element("DVD", id="1")
root.new_child = child[1]

Thank you

More information about the Python-list mailing list