// Log the error
 private void log(int level, SAXParseException e) {
   int line = e.getLineNumber();
   int col = e.getColumnNumber();
   String publicId = e.getPublicId();
   String systemId = e.getSystemId();
   StringBuffer sb = new StringBuffer();
   sb.append(e.getMessage());
   if (line > 0 || col > 0) {
     sb.append(": line=");
     sb.append(line);
     sb.append(", col=");
     sb.append(col);
   }
   if (publicId != null || systemId != null) {
     sb.append(": publicId=");
     sb.append(publicId);
     sb.append(", systemId=");
     sb.append(systemId);
   }
   // Log the message
   log.log(level, sb.toString());
 }