--
You received this message because you are subscribed to the Google Groups "scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scrapy-users...@googlegroups.com.
To post to this group, send email to scrapy...@googlegroups.com.
Visit this group at https://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.
Valdir Stumm Junior
|
|
class MyxmlSpider(scrapy.Spider): name = "myxml"
start_urls = ( ["file:///home/sayth/Downloads/20160123RAND0.xml"] )
def parse(self, response): sel = Selector(response)
items = [] for race in sel.xpath('//meeting//race'): item = ConvXmlItem() item['id'] = race.xpath('@id').extract_first() item['num'] = race.xpath('@number').extract_first() item['dist'] = race.xpath('@distance').extract_first() items.append(item)
return items
Further implementation question, if i want to perform 3 queries on the XML as in the above and create relationships, i would create 3 parses as above instead of saving to file would pipelines provide a mechanism to send the scraped data witb a relation?
Thanks
Sayth