xmlReader.setErrorHandler(xmlErrorHandler);
} catch (org.xml.sax.SAXException exc){
throw XMLParseException.exceptionCreatingXMLReader(baseURL, exc);
}
PersistenceContentHandler myContentHandler = new PersistenceContentHandler();
xmlReader.setContentHandler(myContentHandler);
InputSource inputSource = new InputSource(input);
try{
xmlReader.parse(inputSource);
} catch (IOException exc){
throw PersistenceUnitLoadingException.exceptionProcessingPersistenceXML(baseURL, exc);
} catch (org.xml.sax.SAXException exc){
// XMLErrorHandler will handle SAX exceptions
}
// handle any parse exceptions
XMLException xmlError = xmlErrorHandler.getXMLException();
if (xmlError != null) {
throw PersistenceUnitLoadingException.exceptionProcessingPersistenceXML(baseURL, xmlError);
}
Iterator<SEPersistenceUnitInfo> persistenceInfos = myContentHandler.getPersistenceUnits().iterator();
while (persistenceInfos.hasNext()){
SEPersistenceUnitInfo info = persistenceInfos.next();
info.setPersistenceUnitRootUrl(baseURL);
info.setClassLoader(loader);
info.setNewTempClassLoader(loader);
}
return myContentHandler.getPersistenceUnits();
}