this.log.error("Error setting base directory");
} catch (final ConfigurationException e) {
this.log.error("Error setting base directory");
}
final FOraySession session = FOraySpecific.makeFOraySession(
configuration);
FOrayDocument document = null;
if (xsl == null) {
InputSource inputSource = null;
inputSource = new InputSource(xmlFile.toURI().toURL().openStream());
document = new FOrayDocument(session, inputSource, null);
} else {
document = new FOrayDocument(session, xmlFile.toURI().toURL(),
URLFactory.createURL(this.baseDir + "/" + xsl));
}
String outname = xmlFile.getName();
if (outname.endsWith(".xml")) {
outname = outname.substring(0,
outname.length() - ".xml".length());
}
String extension;
if (this.outputPDF) {
extension = ".pdf";
} else {
extension = ".at.xml";
}
final BufferedOutputStream bos = new BufferedOutputStream(
new FileOutputStream(new File(this.destdir,
outname + extension)));
OutputTargetType rendererType = null;
if (this.outputPDF) {
rendererType = OutputTargetType.PDF;
} else {
rendererType = OutputTargetType.XML;
}
final OutputConfig renderOptions = new OutputConfig();
renderOptions.setFineDetail(Boolean.FALSE, SessionConfig.PRECEDENCE_DEFAULT);
renderOptions.setConsistentOutput(Boolean.TRUE, SessionConfig.PRECEDENCE_DEFAULT);
final OutputTarget renderer = OutputTargetFactory.makeOutputTarget(
rendererType, renderOptions, bos, session.getLogger(),
session.getGraphicServer());
new FOrayTarget(document, renderer, null, bos);
this.log.debug("ddir:" + this.destdir + " on:" + outname + ".pdf");
session.process();
// check difference
if (this.compare != null) {
final File f1 = new File(this.destdir, outname + ".at.xml");
final File f2 = new File(this.compare, outname + ".at.xml");