blob: 5b3027450babb774cdccd675c55fad4133f9991c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/env python3
from argparse import ArgumentParser
from xml.dom import minidom
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('--input', '-i', dest='input', required=True, type=str,
help='input xml file')
arg = parser.parse_args()
with open(arg.input, 'r') as f:
doc = minidom.parseString(f.read())
try:
obj = doc.getElementsByTagName('Parcel')[0]
except IndexError:
obj = doc.getElementsByTagName('Building')[0]
num = obj.getAttribute('CadastralNumber')
print(num)
owners = doc.getElementsByTagName('Owner')
if not owners:
util = doc.getElementsByTagName('Utilization')[0].getAttribute('ByDoc')
print('? ' + util)
else:
for o in owners:
for person in o.getElementsByTagName('Person'):
print('- ' + person.getElementsByTagName('Content')[0].firstChild.nodeValue)
for org in o.getElementsByTagName('Organization'):
print('- ' + org.getElementsByTagName('Content')[0].firstChild.nodeValue)
|