XSContext context = getContext();
parser.set(this);
FileOutputStream fos = null;
try {
XsObjectFactory factory = context.getXsObjectFactory();
XsSAXParser xsSAXParser = factory.newXsSAXParser();
context.setCurrentContentHandler(xsSAXParser);
XMLReader xr = factory.newXMLReader(isValidating());
String logDir = System.getProperty("org.apache.ws.jaxme.xs.logDir");
if (logDir != null) {
File tmpFile = File.createTempFile("jaxmexs", ".xsd", new File(logDir));
fos = new FileOutputStream(tmpFile);
LoggingContentHandler lch = new LoggingContentHandler(fos);
lch.setParent(xr);
xr = lch;
String msg = "Read from " + pSource.getPublicId() + ", " + pSource.getSystemId() + " at " + new Date();
lch.comment(msg.toCharArray(), 0, msg.length());
}
xr.setContentHandler(xsSAXParser);
xr.parse(pSource);
if (fos != null) {
fos.close();
fos = null;
}
return (XsESchema) xsSAXParser.getBean();
} finally {
if (fos != null) {
try { fos.close(); } catch (Throwable ignore) {}
}
context.setCurrentContentHandler(null);