* @return Configuration configuration tree
* @throws MappingException
*/
public static Configuration build(InputStream is) throws MappingException{
SAXConfigurationBuilder builder = new SAXConfigurationBuilder();
try{
XMLReader parser = XMLReaderFactory.createXMLReader(
"org.apache.xerces.parsers.SAXParser"
);
parser.setContentHandler(builder);
parser.parse( new InputSource( new InputStreamReader(is) ) );
}
catch (IOException except){
throw new MappingException("mapping.missingDBConf",is.toString());
}
catch (SAXException except){
throw new MappingException(except);
}
//return current configuration
return builder.getConfiguration();
}