W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2011

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

From: Andy Davidson <andy_davidson@apple.com>
Date: Thu, 6 Jan 2011 11:05:38 -0800
Cc: xmlschema-dev@w3.org
Message-Id: <4463D467-BC1F-448F-9DFA-9253695CBC93@apple.com>
To: Michael Kay <mike@saxonica.com>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:30 GMT