// Guard against calling generate before setup.
if (!activeFlag) {
throw new IllegalStateException("generate called on sitemap component before setup.");
}
SAXParser parser = null;
StringWriter w = new StringWriter();
try {
parser = (SAXParser) this.manager.lookup(SAXParser.ROLE);
if (getLogger().isDebugEnabled()) {
getLogger().debug("Processing File: " + super.source);
}
if (!tmplEngineInitialized) {
tmplEngine.init();
tmplEngineInitialized = true;
}
/* lets render a template */
this.tmplEngine.mergeTemplate(super.source, velocityContext, w);
InputSource xmlInput =
new InputSource(new StringReader(w.toString()));
xmlInput.setSystemId(super.source);
parser.parse(xmlInput, this.xmlConsumer);
} catch (IOException e) {
getLogger().warn("VelocityGenerator.generate()", e);
throw new ResourceNotFoundException("Could not get Resource for VelocityGenerator", e);
} catch (SAXParseException e) {
int line = e.getLineNumber();