I'm looking at this XML:
https://data.cityofnewyork.us/api/views/25th-nujf/rows.xml
I thought I could parse out the 'ethcty' and 'cnt' items from the list, using the code below, but I'm actually getting nothing at all.
import xml.etree.ElementTree as ET
tree = ET.parse('https://data.cityofnewyork.us/api/views/25th-nujf/rows.xml')
root = tree.getroot()
for child in root:
print(child.tag, child.attrib)
for _id in root.findall('_id'):
rank = _id.find('ethcty').text
name = _id.get('cnt')
print(name, rank)
I am following the examples from the URL below.
https://docs.python.org/3.4/library/xml.etree.elementtree.html