Re: trouble creating javax.xml.validation.Validator from locally cached version of XMLSchema.xsd

Hi Michael

Thanks 

quick recap of my problem:
- I need to take xsd files as input
- I want to make sure the xsd files are valid before I start processing.
	- if they are not valid it would be nice to get an error message like you could generate from a SAXParseException.
- My tool has to work even if it is offline or w3.org is not available.

If I understand your proposal, you are saying the SchemaFactory.newInstance() is hard code to know about XMLSchema validation. Because the API has you pass a string "http://www.w3.org/2001/XMLSchema" instead of an enumerated value. I assumed the factory had no explicit knowledge about XMLSchema, so I was doing a lot of work to create Sources for XMLSchema.xsd, creating a validator for XMLSchema, ...

 
I should have time this week end to give this a try. 

Andy

On Jan 4, 2011, at 3:04 PM, Michael Kay wrote:

> On 04/01/2011 22:20, Andy Davidson wrote:
>> Hi Michael
>> 
>> Can you tell me more? What do you mean by a "schema processor"?
>> 
>> thanks
>> 
>> Andy
>> 
> 
> What I mean is that if you do this:
> 
>        SchemaFactory factory =
>            SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
>        File schemaLocation = new File("docbook.xsd");
>        Schema schema = factory.newSchema(schemaLocation);
> 
> then you will have performed a much more rigorous check on the validity of docbook.xsd than you will get by loading it as a source document and validating it against XMLSchema.xsd.
> 
> Michael Kay
> Saxonica
> 

Received on Thursday, 6 January 2011 19:06:42 UTC