@@ -39,6 +39,8 @@ def checkInvalidTags(soup):
39
39
print ('The following tags were found that may be misspelled or the wrong case:' )
40
40
for tag in bad_tags :
41
41
print (' ' + tag )
42
+ return False
43
+ return True
42
44
43
45
44
46
def getSchemaFile (url , chkCert = False , to = 30 ):
@@ -62,8 +64,7 @@ def getSchemaFile(url, chkCert=False, to=30):
62
64
# check if file is returned and is legit XML
63
65
if "xml" in doctype and status in [200 , 204 ] and filedata :
64
66
soup = BeautifulSoup (filedata , "xml" )
65
- checkInvalidTags (soup )
66
- success = True
67
+ success = checkInvalidTags (soup )
67
68
except Exception as ex :
68
69
print ("Something went wrong: %s %s" % (ex , status ), file = sys .stderr )
69
70
@@ -81,7 +82,7 @@ def getRefs(soup):
81
82
refs = [(ref .get ('Uri' ), ref ) for ref in reftags ]
82
83
for cnt , url in enumerate (refs ):
83
84
if url is None :
84
- print ("The Uri in this Reference #{} is missing, please check for capitalization of Uri" .format (cnt ))
85
+ print ("The Uri in this Reference #{} is missing, please check for capitalization of Uri" .format (cnt ), file = sys . stderr )
85
86
return refs
86
87
87
88
@@ -103,9 +104,8 @@ def getAlias(uri, aliasDict):
103
104
print (fileName )
104
105
fileData = f .read ()
105
106
soup = BeautifulSoup (fileData , "xml" )
106
- checkInvalidTags (soup )
107
107
print ("Using alias: {} {}" .format (uri , fileName ))
108
- return soup is not None , soup
108
+ return soup is not None and checkInvalidTags ( soup ) , soup
109
109
110
110
111
111
if __name__ == "__main__" :
0 commit comments