Beispiel #1
0
 def test_it_works(self):
     tree = parse_html(XML)
     result = TreeInterface(tree).structured_xpath(
         '//issue',
         title='./title/text()',
         date='./date/text()',
         about='./about/text()',
         number=('./number/text()', int),
         home_url='./home-url/text()',
     )
     self.assertEqual(result, [{
         "date": "12.09.98",
         "about": "XML",
         "home_url": "www.j.ru/issues/",
         "number": 448,
         "title": "XML today"
     }])
Beispiel #2
0
 def structure(self, *args, **kwargs):
     return TreeInterface(self.tree).structured_xpath(*args, **kwargs)