List Info

Thread: newb: Lxml Objectify




newb: Lxml Objectify
country flaguser name
United States
2007-03-30 20:45:42
<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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: newb: Lxml Objectify
country flaguser name
Australia
2007-03-30 22:14:08
On Sat, 2007-03-31 at 01:45 +0000, johnny wrote:
> <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]

I think I'm missing the bit where this is related to Django.
Did you
post to the wrong list or is there a specific Django
question you are
asking here?

Thanks,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: newb: Lxml Objectify
country flaguser name
United States
2007-03-31 07:38:00
I am trying to do this inside Django view.  I am new to
python, I
thought someone might have used lxml to process and create
xml
documents in Django.  I looked at the documentation, but for
newb, I
need to see an examle like this.

Thank you.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )