Я пробовал этот код:
импортируйте xml.etree.ElementTree как ET< /p>
def loadfile():
print("Начинаем процесс загрузки файла...")
Код: Выделить всё
tree = ET.parse(r'gml file')
root = tree.getroot()
print("File loaded successfully.")
namespaces = {
'core': 'http://www.opengis.net/core',
'bldg': 'http://www.opengis.net/citygml/building/2.0',
'gml': 'http://www.opengis.net/gml'
}
for building in root.findall('.//core:cityObjectMember/bldg:Building', namespaces):
building_id = building.get('{http://www.opengis.net/gml}id')
if building_id:
print("Building ID:", building_id)
else:
print("No gml:id attribute found for this building")
loadfile()
Подробнее здесь: https://stackoverflow.com/questions/787 ... ing-python