Re: Validating xml file with schema using xerces-j

> Nguyen, Thang wrote...
> 
> Hi, 
> I'm currently trying to figure out how to make my program validate
> an xml file againt a schema file using xerces-j

First question is which version of xerces-j are you using?. If you are using 
xerces2, then, hold it!. Xerces2 does not support schema support, as of now.

If you are using xerces1 (1.4.x), then you can either instantiate parser as 
SAXParser or DOMParser. Set the feature on to support validation and invoke 
parser.parse(). This will validate your xml file against schema.

> 
> I can't seem to find which class to instantiate to include the schema file
> (xsd)

This question is not very clear to me.
The xml instance file points to the schema file against which validation is to 
be performed. So, the schema file is picked from the location, pointed out by 
xml instance and carries on with the validation process.

Why do you need to instantiate a class to include schema.

-Rahul.

> 
> thanks for any help,
> 
> 

Received on Thursday, 11 October 2001 01:41:31 UTC