scrapy/scrapy — pull request #66 by mbeydon (2011-12-12 14:54:31+00:00)
Title: XML and JSON exporter modified to support complex items

Hello,

I've changed the export_item() method of the XmlItemExporter and the JsonItemExporter so that it would support complex items. What I mean by complex items is simply and item containing an item (basically a simple dictionary). I felt the need to make these modifications while using scrapy simply because I faced a page where items where related to other items and I needed an "item tree". Unfortunatly, the base XML and JSON exporters do not support "item trees".

The real modification I've made to the JSON exporter was to bypass the get_serialized_values method and go straight to the JsonEncoder.

For the XML exporter, I merely just added recursion for dictionaries, so that if you have items in items in items, the final file will look like a real XML tree.

Hope these modifications are useful.