Hi Mukul, Mukul Gandhi <[email protected]> wrote on 06/11/2009 07:45:20 AM:
> Hi Hiranya, > > On Thu, Jun 11, 2009 at 4:05 PM, Hiranya > Jayathilaka<[email protected]> wrote: > > This approach seems to be working. It logs error messages when the XSD is > > invalid. But how do I know if something went wrong at Java code level? > > I do not understand the question, "if something went wrong at Java > code level?". There could be something wrong with the Schema, which > this Java program reports. > Could you please clarify what you mean. > > > Is there any return value or exception that I could capture in my code? > > I think, the code I posted utilizes the error handler configured with > the Schema loader, to report the errors. 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 XSModel xsModel = xsLoader.loadURI(xsdUri); > -- > Regards, > Mukul Gandhi > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] Thanks.> Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [email protected] E-mail: [email protected]
