* All doConfigure methods evenually call this form.
* */
public void doConfigure(
InputSource inputSource, LoggerRepository repository) {
this.repository = repository;
ExecutionContext ec = joranInterpreter.getExecutionContext();
ec.pushObject(repository);
String errMsg;
try {
attachListAppender(repository);
getLogger(repository).debug("Starting to parse input source.");
SAXParserFactory spf = SAXParserFactory.newInstance();
// we want non-validating parsers
spf.setValidating(false);
SAXParser saxParser = spf.newSAXParser();
saxParser.parse(inputSource, joranInterpreter);
getLogger(repository).debug("Finished parsing.");
} catch (SAXException e) {
// all exceptions should have been recorded already.
} catch (ParserConfigurationException pce) {
errMsg = "Parser configuration error occured";
getLogger(repository).error(errMsg, pce);
ec.addError(new ErrorItem(errMsg, pce));
} catch (IOException ie) {
errMsg = "I/O error occured while parsing xml file";
ec.addError(new ErrorItem("Parser configuration error occured", ie));
} finally {
detachListAppender(repository);
}
}