use of org.apache.maven.doxia.index.IndexEntry in project maven-plugins by apache.
the class PdfMojo method getGeneratedDocumentTitle.
/**
* Parse a generated Doxia file and returns its title.
*
* @param f not null
* @return the xdoc file title or null if an error occurs.
* @throws IOException if any
* @since 1.1
*/
private String getGeneratedDocumentTitle(final File f) throws IOException {
final IndexEntry entry = new IndexEntry("index");
final IndexingSink titleSink = new IndexingSink(entry);
Reader reader = null;
try {
reader = ReaderFactory.newXmlReader(f);
doxia.parse(reader, f.getParentFile().getName(), titleSink);
reader.close();
reader = null;
} catch (ParseException e) {
getLog().error("ParseException: " + e.getMessage());
getLog().debug(e);
return null;
} catch (ParserNotFoundException e) {
getLog().error("ParserNotFoundException: " + e.getMessage());
getLog().debug(e);
return null;
} finally {
IOUtil.close(reader);
}
return titleSink.getTitle();
}
Aggregations