Hi Alberto,

Thanks for the prompt and detailed response.

Whenever a system is implemented in terms of itself, you always reach a
point where there are low-level primitives that cannot be expressed
"normally". I am not surprised to see this applies to the "schema for
schemas", but thanks for clarifying the issue for me.

What I want to do is write some code that will:

        /1/ Parse a ".xml" or ".xsd" file and do as much checking
            as Xerces will allow for that type of file, and then...

        /2/ Build a DOM tree for the parsed file.

I had a look at the API documentation for loadGrammar(). If I understand
your email and the documentation correctly then my algorithm should be
something like the following pseudo-code:

parser = new XercesDOMParser();
parser->setDoNamespaces(true);
parser->setErrorHandler(...);
if (inputFilename ends in ".xsd") {
    parser->setDoSchema(false);
    parser->setValidationScheme(XercesDOMParser::Val_Never);
    parser->loadGrammar(inputFilename, Grammar::SchemaGrammarType);
} else {
    parser->setDoSchema(true);
    parser->setValidationSchemaFullChecking(true);
    parser->setValidationScheme(XercesDOMParser::Val_Always);
}
parser->parse(inputFilename);

In effect, I should use full schema checks for ".xml" files, but for
".xsd" files I should turn off schema checking and compensate for this
by calling loadGrammar(). Is this correct?


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