Hi Mukul,

Mukul Gandhi <[email protected]> wrote on 06/11/2009 06:05:46 AM:

> Hi Hiranya,
>   I think, an easy way to do this is to try building an XSModel
pragmatically.
>
> Here is a sample code fragment which does this:
>
> XSLoaderImpl xsLoader = new XSLoaderImpl();
> XSModel xsModel = xsLoader.loadURI(xsdUri);
>
> We can't build an XSModel, from an invalid XML Schema document. The
> call, loadURI would give an error in case of invalid Schema documents.

Actually you can build an XSModel from invalid XML Schema documents. Upon
encountering an error Xerces will try to recover and repair the schema
document. (Sandy did some work [1] recently to improve the error recovery.)
Each of these errors will be reported to an error handler if you've
registered one and that error handler can choose to abort if the
application doesn't want to accept an XSModel built from an invalid schema.

> On Thu, Jun 11, 2009 at 2:36 PM, Hiranya
> Jayathilaka<[email protected]> wrote:
> > Hi Folks,
> >
> > I would like to know how I can validate an XML schema (1.0) document
using
> > Xerces2. I want  to validate  a given XML schema document against the
schema
> > for schemas programmatically. Can somebody please provide me the
> > instructions on the right way to do this in Java? A pointer to a sample
code
> > fragment is most appreciated.
> >
> > Also can somebody tell me whether validating a schema causes any
imported
> > schema documents to be validated?
> >
> > Thanks,
> > Hiranya
> >
> > --
> > Hiranya Jayathilaka
> > Software Engineer;
> > WSO2 Inc.;  http://wso2.org
> > E-mail: [email protected];  Mobile: +94 77 633 3491
> > Blog: http://techfeast-hiranya.blogspot.com
>
>
> --
> Regards,
> Mukul Gandhi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]

Thanks.

[1] http://issues.apache.org/jira/browse/XERCESJ-1372

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [email protected]>
E-mail: [email protected]

Reply via email to