3 Simple proof of concept program to show how we traverse the testing hierarchy
4 of an XML testing namelist
7 Boreal Scientific Computing LLC, Fairbanks, Alaska, USA
8 Don.Morton@borealscicomp.com
11 import xml.etree.ElementTree
as ET
13 tree = ET.parse(
'stuff2.xml')
16 print 'root tag and attrib: '
17 print root.tag, root.attrib
19 print 'Distribution variables:'
22 if child.text.strip():
23 print child.tag, child.text.strip()
24 if child.tag ==
"metcase":
26 metcasechildren = child.getchildren()
29 for m
in metcasechildren:
30 print m.tag, m.text.strip()
32 if m.tag ==
'runcase':
33 runcasechildren = m.getchildren()
36 for r
in runcasechildren:
37 print r.tag, r.text.strip()
39 if r.tag ==
'basictest':
40 basictestchildren = r.getchildren()
43 for b
in basictestchildren:
44 print b.tag, b.text.strip()
48 for elem in tree.iter():
49 print elem.tag, elem.text