} catch (SAXException e) {
log.error("An error occurred while parsing the c3po profile: {}", e.getMessage());
}
if (validate && !this.isValid(parser, stream)) {
throw new ParserException("Validation was turned on, but the xml file is not valid against the schema.");
}
try {
final SAXReader reader = new SAXReader();
this.profile = reader.read(stream);
final Namespace namespace = this.profile.getRootElement().getNamespace();
if (!namespace.getStringValue().equals(C3PO_NAMESPACE)) {
throw new ParserException("Cannot parse the profile, namespace does not match");
}
} catch (final DocumentException e) {
log.error("An error occurred while reading the profile: {}", e.getMessage());
this.profile = null;
}