Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
validXML.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 #
3 # Figure out if input file is valid XML
4 #
5 # Type "validXML {xmlFileName}
6 #
7 
8 import elementtree.ElementTree as ET
9 import sys
10 
11 ##
12 ## Begin
13 ##
14 
15 if len(sys.argv) < 2:
16  print "usage: ", sys.argv[0], " {xmlFileName}"
17 
18 else:
19  fname = sys.argv[1]
20  print "Checking ",fname
21 
22  tree = ET.parse(fname)
23 
24  root = tree.getroot()
25 
26  if root.tag == "Tests":
27  print "format is OK"
28  else:
29  print "Invalid, \"Tests\" is not defined in the XML file."