def determine_xml(xml_file=''):
'''
Determine what type of XML file this is; facility, group,
user, master, or unknown
'''
tree = ET.parse(xml_file)
root = tree.getroot()
xml_type = ''
if 'FacilityTable' in str(root):
xml_type = 'facility'
elif 'GroupTable' in str(root):
xml_type = 'group'
elif 'UserTable' in str(root):
xml_type = 'user'
elif 'Inventory' in str(root):
xml_type = 'master'
else:
xml_type = 'unknown'
return xml_type
评论列表
文章目录