objectify.parse() returns lxml.etree._ElementTree instead of lxml.objectify.ObjectifiedElement
Hi,
Any idea why objectify.parse() is returning an lxml.etree._ElementTree
object while objectify.parsestring()
returns lxml.objectify.ObjectifiedElement?
I've installed lxml 2.3.4 using easy_install on Ubuntu 10.04.
from lxml import objectify
import StringIO
obj = objectify.parse(StringIO.StringIO("<foo><bar>1</bar></foo>"))
print type(obj) #prints
Am 30.05.2012 03:40, schrieb Roger Hoover:
Any idea why objectify.parse() is returning an lxml.etree._ElementTree object while objectify.parsestring()
I assume you meant "fromstring()"?
returns lxml.objectify.ObjectifiedElement?
I've installed lxml 2.3.4 using easy_install on Ubuntu 10.04.
from lxml import objectify import StringIO obj = objectify.parse(StringIO.StringIO("<foo><bar>1</bar></foo>")) print type(obj) #prints
Can't check right now, but I'm pretty sure there's a FAQ entry about it (and if not, then it's certainly spelled out in the docs somewhere). Short answer: use cases. Stefan
Oh, I see. I need to call obj.get_root() to the ObjectifiedElement.
Thanks.
Roger
On Fri, Jun 1, 2012 at 8:48 AM, Stefan Behnel
Am 30.05.2012 03:40, schrieb Roger Hoover:
Any idea why objectify.parse() is returning an lxml.etree._ElementTree object while objectify.parsestring()
I assume you meant "fromstring()"?
returns lxml.objectify.ObjectifiedElement?
I've installed lxml 2.3.4 using easy_install on Ubuntu 10.04.
from lxml import objectify import StringIO obj = objectify.parse(StringIO.StringIO("<foo><bar>1</bar></foo>")) print type(obj) #prints
Can't check right now, but I'm pretty sure there's a FAQ entry about it (and if not, then it's certainly spelled out in the docs somewhere).
Short answer: use cases.
Stefan _________________________________________________________________ Mailing list for the lxml Python XML toolkit - http://lxml.de/ lxml@lxml.de https://mailman-mail5.webfaction.com/listinfo/lxml
participants (2)
-
Roger Hoover
-
Stefan Behnel