Hi Michael,
I saw the code in XSLoaderImpl.java where it's written like (in the
'loadURI' method):
catch (Exception e){
fSchemaLoader.reportDOMFatalError(e);
return null;
}
The definition of reportDOMFatalError is something like below:
void reportDOMFatalError(Exception e) {
if (fErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl();
error.fException = e;
error.fMessage = e.getMessage();
error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
fErrorHandler.getErrorHandler().handleError(error);
}
}
Looking at the method reportDOMFatalError, I thought some default
error handler has been registered with the XMLSchemaLoader.
But your suggestion looks great, to register a custom error handler. I
would explore it further and would get back with questions to the
list..
On Thu, Jun 11, 2009 at 6:25 PM, Michael
Glavassevich<[email protected]> wrote:
> I didn't see that in the snippet you posted. If you want programatic access
> to error information then you need to explicitly register an error handler:
>
> DOMErrorHandler myErrorHandler = ...;
>
> XSImplementation xsImpl = (XSImplementation)
> registry.getDOMImplementation("XS-Loader");
> XSLoader xsLoader = xsImpl.createXSLoader(null);
>
> DOMConfiguration config = xsLoader.getConfig();
> config.setParameter("error-handler", myErrorHandler); // <-- set the error
> handler
--
Regards,
Mukul Gandhi
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]