HaveF / feedparser

Automatically exported from code.google.com/p/feedparser
Other
0 stars 0 forks source link

Text values of namespaced elements are missing #301

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Sample Feed: http://itunes.apple.com/us/rss/topalbums/limit=10/xml

Notice the "im" namespace. Accessing these elements sort of works as the 
documents suggest:

doc.entries[0].im_name

However, in the feedparser dict, the elements with attributes as well as text 
values only contain the attributes. The text values have been stripped and 
discarded.

>>> import feedparser
>>> d = 
feedparser.parse('http://itunes.apple.com/us/rss/topalbums/limit=10/xml')
>>> d.entries[0].im_name
u'Hell On Heels'
>>> d.entries[0].im_artist
{'href': u'http://itunes.apple.com/us/artist/pistol-annies/id444036171?uo=2'}

The first element (im_name) worked correctly, the value was displayed with no 
attributes. 
Corresponding XML: <im:name>Hell On Heels</im:name>

However the second element (im_artist) only contained the XML attributes and 
the text value is missing. 
Corresponding XML:
<im:artist 
href="http://itunes.apple.com/us/artist/pistol-annies/id444036171?uo=2">Pistol 
Annies</im:artist>

Ideally I would like to be able to access the text value of this element.

Original issue reported on code.google.com by unnamedrambler@gmail.com on 27 Aug 2011 at 10:26

GoogleCodeExporter commented 9 years ago

Original comment by kurtmckee on 9 Sep 2011 at 2:06