Hi Ciaran,
if you ask Xerces to always validate a file, you will get an error if that file is not associated with a schema, and XSD files don't have a reference to the "schema for schema". Furthermore, even if you added such reference, you would get other validation errors, complaining that the xmlschema.xsd file is not valid. This because the "schema for schema" is allowed to do things that normal schemas cannot do (like defining the basic datatypes) and so it cannot be treated as a real schema.

In short, the answer is that you cannot validate schema files using XSD validation, but you need to use loadGrammar API; that will do the same checking specified in the "schema for schema", plus more checking that are in the spec but cannot be expressed in the XSD language.

Hope this helps,
Alberto

At 11.08 17/11/2005 +0000, Ciaran McHale wrote:
Hi folks,

I downloaded the binary version of Xerces C++ 2.7.0 for Windows and am
using it to help me get up to speed with XML and XML Schema. So please
excuse me if this is a "novice" question.

In the "samples/data" directory of Xerces, I ran the following command
for all the files:

    DOMPrint -n -s -f -v=always <filename>

The above command worked for the two ".xml" files. So far, so good.

The above command failed for the ".dtd" files. This is fine because a
".dtd" file is *not* in XML format.

What confuses me is that the above command failed for the ".xsd" file.
The file is well formed, as I can see if I run DOMPrint on it *without*
the schema validation options. However, when I use the schema
validation options then DOMPrint complains about 128 validity errors.
(I won't bother including the ".xsd" file or a printout of the validity
errors here because it is trivial to reproduce the issue with an
installation of Xerces.)

This issue surprises me because I was expecting to be able to use a
validating parser (such as Xerces) to validate schemas as well as
schema instances.

Am I doing something wrong? Is there a mistake in the ".xsd" document?
Is there a bug or limitation in Xerces?


Regards,
Ciaran.
--
Ciaran McHale, Ph.D.        Email: [EMAIL PROTECTED]
Principal Consultant        Tel: +44-7866-416-134 (mobile)
IONA Technologies, UK       WWW: www.iona.com


Reply via email to