public void execute() throws BuildException {
if (this.sitemap == null)
{
throw new BuildException("The [sitemap] attribute must be set");
}
if (this.outputDir == null)
{
throw new BuildException("The [outputDir] attribute must be set");
}
if (!this.sitemap.exists())
{
throw new BuildException(
"The [sitemap] attribute must point to an existing file");
}
log("Checking sitemap at [" + sitemap + "]", Project.MSG_INFO);
log("Generated doc output directory is [" + outputDir + "]",
Project.MSG_VERBOSE);
try
{
DocumentBuilder builder = getDocumentBuilder();
builder.setEntityResolver(this.xmlCatalog);
Document document = builder.parse(sitemap);
if (!checkSitemap(document) && (this.failOnError))
{
throw new BuildException("Found errors in sitemap.");
}
}
catch (SAXException e)
{
throw new BuildException(e);
}
catch (IOException e)
{
throw new BuildException(e);
}
catch (ParserConfigurationException e)
{
throw new BuildException(e);
}
}
|