-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcheck_xml.py
More file actions
29 lines (26 loc) · 1.11 KB
/
check_xml.py
File metadata and controls
29 lines (26 loc) · 1.11 KB
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
import xml.etree.ElementTree as ET
import os
os.chdir('/Users/brewertonsantos/dev/pokeorigins-tibia/assets-and-map-editor')
# Check borders
tree = ET.parse('src/App/data/brushes/borders.xml')
for border in tree.findall('.//border'):
if border.get('id') is None:
print(f'BORDER MISSING ID: {ET.tostring(border, encoding="unicode")[:200]}')
# Check grounds
tree2 = ET.parse('src/App/data/brushes/grounds.xml')
for brush in tree2.findall('.//brush'):
if brush.get('type') != 'ground':
continue
for item in brush.findall('item'):
if item.get('id') is None:
print(f'ITEM MISSING ID in brush={brush.get("name")}')
for border in brush.findall('border'):
if border.get('id') is None:
print(f'BORDER MISSING ID in brush={brush.get("name")}')
for friend in brush.findall('friend'):
if friend.get('name') is None:
print(f'FRIEND MISSING NAME in brush={brush.get("name")}')
opt = brush.find('optional')
if opt is not None and opt.get('id') is None:
print(f'OPTIONAL MISSING ID in brush={brush.get("name")}')
print('Done checking')