From fd0c061ec6c5966251d7ec7ff0f508e1fa1d91dc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 17 Feb 2011 21:21:06 +0200 Subject: textxml: fix crash if item dont have id. --- testxml/testxml.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/testxml/testxml.py b/testxml/testxml.py index 8345444..80ac29c 100755 --- a/testxml/testxml.py +++ b/testxml/testxml.py @@ -719,8 +719,21 @@ def testItems(fileName, imgDir): print "Checking items.xml" dom = minidom.parse(parentDir + fileName) idset = set() + oldId = None for node in dom.getElementsByTagName("item"): - id = node.attributes["id"].value + if node.parentNode != dom.documentElement: + continue + + try: + id = node.attributes["id"].value + except: + if oldId is None: + print "error: item without id" + else: + print "error: item without id. Last id was: " + oldId + errors = errors + 1 + continue + oldId = id if id in idset: print "error: duplicated id=" + id errors = errors + 1 -- cgit v1.2.3-70-g09d2