File indexing completed on 2023-03-17 11:27:28
0001
0002
0003 import sys
0004 import xml.etree.ElementTree as ET
0005
0006 inputFile = sys.argv[1]
0007 print ("Reading input file ", inputFile)
0008
0009 tree = ET.parse(inputFile)
0010 root = tree.getroot()
0011
0012 sortList = []
0013 elem = root.find('MaterialSection')
0014 for subelem in elem :
0015 key = subelem.get('name')
0016 print (key)
0017 sortList.append((key, subelem))
0018
0019 sortList.sort()
0020 for item in sortList :
0021 print (item[0])
0022
0023 elem[:] = [item[-1] for item in sortList]
0024
0025 outputFile = sys.argv[2]
0026 tree.write(outputFile)