Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > newb: lxml objectify

Reply
Thread Tools

newb: lxml objectify

 
 
johnny
Guest
Posts: n/a
 
      03-30-2007
<Library>
<DVD id="1">
<title>Breakfast at Tiffany's</title>
<format>Movie</format>
<genre>Classic</genre>
</DVD>

<DVD id="2">
<title>Borat</title>
<format>Movie</format>
<genre>Comedy</genre>
</DVD>
</Library>

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gnosis XML objectify Wang, Harry Python 6 11-27-2007 09:15 AM
gnosis XML objectify Wang, Harry Python 0 11-26-2007 09:04 PM
[ANN] lxml 0.9 is out! Stefan Behnel Python 0 03-20-2006 08:17 PM
ANN: MathDOM 0.5.2 - MathML in Python - now featuring lxml API! Stefan Behnel Python 0 10-17-2005 09:30 AM
Article on updates to gnosis.xml.objectify David Mertz, Ph.D. Python 0 12-04-2004 10:38 PM



Advertisments