def parse_field(self, html, fn): response = XmlResponse('http://localhost/test.html', body='<book><row>%s</row></book>' % html) row = response.css('row')[0] node = response.css('entry')[0] declaration = Loader(self.spider, response, LobbyistDeclaration(), row) declaration.add_value(None, fn(node)) item = declaration.load_item() actual = dict(item) return actual
def parse_law_projects(self, html, fn): response = XmlResponse('http://localhost/test.html', body='<book>%s</book>' % html) node = response.css('entry')[0] return fn(node)