Hi Elisha,

The code Boris has looks pretty much optimal to me.  Rest assured that 
lots of work went into Xerces-C to enable it to verify the validity of 
schema documents, both as per the constraints in the Schema for Schemas 
and the language in the Rec.  You might also want to take a look at some 
of the new features that have been added to do things like validate the 
contents of schema annotations with respect to components of the schema.

Cheers,
Neil
Neil Graham
Manager, XML Parser Development
IBM Toronto Lab
Phone:  905-413-3519, T/L 969-3519
E-mail:  [EMAIL PROTECTED]





Boris Kolpackov <[EMAIL PROTECTED]> 
Sent by: news <[EMAIL PROTECTED]>
05/26/2005 12:39 PM
Please respond to
c-dev


To
c-dev@xerces.apache.org
cc

Subject
Re: Validating XSD(s)






"Elisha Berns" <[EMAIL PROTECTED]> writes:

> But my question is, once again, assuming that you are only using Xerces,
> what is the best and most thorough way to validate an XSD?

Alright, seeing that you are asking this 10th time I will take a shot.
In my code I do basically the following:


// Perform namespace processing.
//
parser->setFeature (XMLUni::fgDOMNamespaces, true);


// Enable the parser's schema support.
//
parser->setFeature (XMLUni::fgXercesSchema, true);


// Enable full schema constraint checking, including checking which
// may be time-consuming or memory intensive. Currently, particle
// unique attribution constraint checking and particle derivation
// restriction checking are controlled by this option.
//
parser->setFeature (XMLUni::fgXercesSchemaFullChecking, true);

// The parser will treat validation error as fatal and will exit.
//
parser->setFeature (XMLUni::fgXercesValidationErrorAsFatal, true);


ErrorHandler eh;
parser->setErrorHandler(&eh);


parser->loadGrammar (uri, Grammar::SchemaGrammarType);


parser->release();



It works pretty well for me so far. I.e., every time I mess up
my schemas the above code catches it.

hth,
-boris


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to