from xml.dom import minidom import httplib , os, sys def fileExists(f): try: file = open(f) except IOError: exists = False else: file.close() exists = True return exists def testTiles( dir): xmldoc=minidom.parse(dir +"/WEB-INF/tiles-def.xml") #tiles_def= xmldoc.getElementsByTagName("tiles-definitions") tiles_def= xmldoc.childNodes[3] defs =tiles_def.getElementsByTagName("definition") for df in defs: vl = df.getElementsByTagName("put") for k in vl: v = k.getAttribute("value") if v.endswith(".jsp"): fn = dir +v if not fileExists(fn) : print "No file [%s]." % fn def testStruts( dir): xmldoc=minidom.parse(dir +"/WEB-INF/struts-config.xml") struts= xmldoc.getElementsByTagName("struts-config") for se in struts: for sa in se.getElementsByTagName("action-mappings"): for s in sa.getElementsByTagName("action"): v = s.getAttribute("path") if v.endswith(".jsp"): fn = dir +v if not fileExists(fn) : print "Action path No file [%s]." % fn fl = s.getElementsByTagName("forward") for f in fl: v = f.getAttribute("path") if v.endswith(".jsp"): fn = dir +v print fn if not fileExists(fn) : print "Action/forward path No file [%s]." % fn dir = "c:/dev/jsp/asp" testStruts(dir)