Zoltan2
Loading...
Searching...
No Matches
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
8import elementtree.ElementTree as ET
9import sys
10
11
14
15if len(sys.argv) < 2:
16 print "usage: ", sys.argv[0], " {xmlFileName}"
17
18else:
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."