[lxml-dev] Hello, is this a bug ?
Hello, First of all, good job with lxml. Actually, i have a problem, and i think it might be a bug: Let's say i have to parse this xml: <title>casual carpool, serendipity and radovan karadzic</title> <link rel="alternate" type="text/html" href="http://sippey.typepad.com/filtered/2008/07/casual-carpool-serendipity-and-ra..." /> <link rel="replies" type="text/html" href="http://sippey.typepad.com/filtered/2008/07/casual-carpool-serendipity-and-ra..." thr:count="3" thr:updated="2008-07-23T12:06:32-07:00" /> <id>tag:typepad.com,2003:post-53080848</id> <published>2008-07-22T11:54:03-07:00</published> <updated>2008-07-23T12:06:33-07:00</updated> <summary type="html">"[Casual carpool](http://www.ridenow.org/carpool/)" is one of those (sub)urban fabric things that makes life in the Bay Area go 'round...and occasionally makes it just a bit more interesting. Every morning commuters gather at one of a couple dozen sites in the East...</summary> <author> <name>Michael Sippey</name> </author> <category scheme="http://www.sixapart.com/ns/types#category" term="Berkeley" /> -- Dumitrache Mihai - Marian http://www.takemyview.com/blog
I am so sorry. The email should not be send. (stupid email manager) I have this xml: <entry> <title>casual carpool, serendipity and radovan karadzic</title> <author> <name>Michael Sippey</name> </author> <category scheme="http://www.sixapart.com/ns/types#category" term="Berkeley" /> </entry> I entered in the entry tag with iterchildren for proper in element.iterchildren(): print proper.tag The problem is that the 'category' tag it's not read. And i think it's because it does not have any data : <content /> Please tell me if i miss something. Thank you -- Dumitrache Mihai - Marian http://www.takemyview.com/blog
Hi, mmdumi wrote:
I have this xml: <entry> <title>casual carpool, serendipity and radovan karadzic</title> <author> <name>Michael Sippey</name> </author> <category scheme="http://www.sixapart.com/ns/types#category" term="Berkeley" /> </entry>
I entered in the entry tag with iterchildren for proper in element.iterchildren(): print proper.tag
The problem is that the 'category' tag it's not read.
import lxml.etree as et et.__version__ '2.2.alpha1' xml = b""" ... <entry> ... <title>casual carpool, serendipity and radovan karadzic</title> ... <author> ... <name>Michael Sippey</name> ... </author> ... <category scheme="http://www.sixapart.com/ns/types#category" ... term="Berkeley"/> ... </entry> ... """ element = et.fromstring(xml) for proper in element.iterchildren(): ... print(proper.tag) ...
works for me: Python 3.0b2 (r30b2:65080, Jul 20 2008, 20:03:32) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. title author category
And i think it's because it does not have any data : <content />
Not sure what you mean here. Stefan
participants (2)
-
mmdumi -
Stefan Behnel