SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
XMLReader xmlReader = null;
SAXParser sp = null;
XMLExceptionHandler xmlErrorHandler = new XMLExceptionHandler();
// 247735 - remove the validation of XML.
// create a SAX parser
try {
sp = spf.newSAXParser();
} catch (javax.xml.parsers.ParserConfigurationException exc){
throw XMLParseException.exceptionCreatingSAXParser(baseURL, exc);
} catch (org.xml.sax.SAXException exc){
throw XMLParseException.exceptionCreatingSAXParser(baseURL, exc);
}
// create an XMLReader
try {
xmlReader = sp.getXMLReader();
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();