for (int count = 0; count < catalogFiles.size(); count++) {
String file = (String) catalogFiles.elementAt(count);
catalog.parseCatalog(file);
}
XParseError xpe = new XParseError(showErrors, showWarnings);
xpe.setMaxMessages(maxErrs);
reader.setErrorHandler(xpe);
String parseType = validating ? "validating" : "well-formed";
String nsType = nsAware ? "namespace-aware" : "namespace-ignorant";
if (maxErrs > 0) {
System.out.println("Attempting "
+ parseType
+ ", "
+ nsType
+ " parse");
}
Date startTime = new Date();
try {
reader.parse(xmlfile);
} catch (SAXException sx) {
System.out.println("SAX Exception: " + sx);
} catch (Exception e) {
e.printStackTrace();
}
Date endTime = new Date();
long millisec = endTime.getTime() - startTime.getTime();
long secs = 0;
long mins = 0;
long hours = 0;
if (millisec > 1000) {
secs = millisec / 1000;
millisec = millisec % 1000;
}
if (secs > 60) {
mins = secs / 60;
secs = secs % 60;
}
if (mins > 60) {
hours = mins / 60;
mins = mins % 60;
}
if (maxErrs > 0) {
System.out.print("Parse ");
if (xpe.getFatalCount() > 0) {
System.out.print("failed ");
} else {
System.out.print("succeeded ");
System.out.print("(");
if (hours > 0) {
System.out.print(hours + ":");
}
if (hours > 0 || mins > 0) {
System.out.print(mins + ":");
}
System.out.print(secs + "." + millisec);
System.out.print(") ");
}
System.out.print("with ");
int errCount = xpe.getErrorCount();
int warnCount = xpe.getWarningCount();
if (errCount > 0) {
System.out.print(errCount + " error");
System.out.print(errCount > 1 ? "s" : "");
System.out.print(" and ");