> If I understand your proposal, you are saying the SchemaFactory.newInstance() is hard code to know about XMLSchema validation.
The JAXP SchemaFactory interface is designed to support multiple schema
languages. When you call newInstance() you tell it which schema language
you want to use (by means of a URI that identifies that language). The
factory will then search for a schema processor that understands that
schema language. It might fail to find one, but if it succeeds, the
instance returned will be a schema processor that understands XSD (XML
Schema). When you then ask this processor to compile a schema by writing
Schema schema = factory.newSchema(schemaLocation);
the schema processor will ensure that the document at schemaLocation is indeed a valid XSD schema. If any errors are detected while compiling the schema, they will be reported to the ErrorHandler associated with the schema factory, and will also result in the newSchema() call throwing an exception.
Michael Kay
Saxonica
> 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
>>
>