Search code examples
pythonxmlfeedparser

Python Feedparser is missing an entry called "name" in the parsed output


I have an XML file filename.xml with the contents

<product>
  <sku>144249</sku>
  <productId>119223</productId>
  <name>Cannon Digital Camera</name>
  <imageurl>http://bla.com/blu.jpg</imageurl>
</product> 

and I am using the Python Universal Feed Parser module to parse it like this:

f = feedparser.parse('filename.xml')

The resulting parsed output (below) is missing the name entry yet everything else is there.

{'bozo': 0,
 'encoding': 'utf-8',
 'entries': [{'imageurl': u'http://bla.com/blu.jpg',
 'productid': u'119223',
 'sku': u'144249'}],
 'feed': {},
 'namespaces': {},
 'version': ''}

What am I doing wrong?


Solution

  • The answer is to use another tool for the job - this is not an RSS feed. The easiest reason to point out is all RSS feeds must have an <rss> root node, this does not.

    XML is a generic format for storing data, RSS is a format based on XML designed for syndication of content. They have different purposes.