public void addPackageFromXml( final Resource resource ) throws DroolsParserException,
IOException {
this.resource = resource;
final XmlPackageReader xmlReader = new XmlPackageReader( this.configuration.getSemanticModules() );
xmlReader.getParser().setClassLoader( this.rootClassLoader );
try {
xmlReader.read( resource.getReader() );
} catch ( final SAXException e ) {
throw new DroolsParserException( e.toString(),
e.getCause() );
}
addPackage( xmlReader.getPackageDescr() );
this.resource = null;
}