[lxml-dev] Hello, is this a bug ?

Stefan Behnel stefan_ml at behnel.de
Fri Jul 25 11:43:44 CEST 2008


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.

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.
  >>> 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)
  ...
  title
  author
  category


> And i think it's
> because it does not have any data : <content />

Not sure what you mean here.

Stefan



More information about the lxml-dev mailing list