ps.println("</issueReport>");
}
private void printReport(String msg, Throwable e, ExtractionReport er, PrintStream ps) {
XMLValidationReportSerializer reportSerializer = new XMLValidationReportSerializer();
ps.println("<report>");
// Human readable error message.
if(msg != null) {
ps.printf("<message>%s</message>\n", msg);
} else {
ps.print("<message/>\n");
}
// Error stack trace.
if(e != null) {
ps.println("<error>");
ps.println("<![CDATA[");
e.printStackTrace(ps);
ps.println("]]>");
ps.println("</error>");
} else {
ps.println("<error/>");
}
// Issue Report.
printIssueReport(er, ps);
// Validation report.
try {
reportSerializer.serialize(er.getValidationReport(), ps);
} catch (SerializationException se) {
ps.println("An error occurred while serializing error.");
se.printStackTrace(ps);
}
ps.println("</report>");