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

Andy Davidson <[email protected]>
Newsgroups gmane.text.xml.schema.devel
Message-ID <[email protected]>
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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.