Brian,
On IBM alphaworks there is a tool call IBM XML Schema Quality Checker. It is a Java program whose function is to determine if a schema is valid, and if it is not, to give very specific messages about what the problem is. It sometimes even recommends a solution.
Another tool, which can be used over the Web, is XSV. While not as thorough, it has the nice quality that it returns pointers to the W3C Schema Spec Section of any constraints that were violated.
Regards,
Bob

(I'm one of the authors of the IBM XML Schema Quality Checker tool)
see http://www.alphaworks.ibm.com/tech/xmlsqc
see http://www.w3.org/XML/Schema


Please respond to [EMAIL PROTECTED]

To: [EMAIL PROTECTED]
cc:
Subject: Re: Validating a schema is a valid schema



Hi Brian,

When you want to validate a schema by itself, it's always useful to
remember that, even if Xerces were able to handle the schema-for-schemas
with no difficulties, you still wouldn't get complete validation of your
schema by directly referencing it.  There are all kinds of schema-validity
constraints that the schema-for-schemas can't handle, and for them you'll
need the logic built into Xerces.

The best thing to do here is probably to use Xerces preparsing
functionality (and not to directly reference the schema-for-schemas in your
schema).  To see how this works, take a look at

The sample xni.XMLGrammarBuilder should also be useful for you.

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




|---------+---------------------------->
|         |           "Zoltan Bryant"  |
|         |           <[EMAIL PROTECTED]|
|         |           com>             |
|         |                            |
|         |           07/17/2002 03:37 |
|         |           AM               |
|         |           Please respond to|
|         |           xerces-j-user    |
|         |                            |
|---------+---------------------------->
    >---------------------------------------------------------------------------------------------------------------------------------------------|
    |                                                                                                                                             |
    |       To:       [EMAIL PROTECTED]                                                                                                |
    |       cc:                                                                                                                                   |
    |       Subject:  Validating a schema is a valid schema                                                                                       |
    |                                                                                                                                             |
    |                                                                                                                                             |
    >---------------------------------------------------------------------------------------------------------------------------------------------|




Does anyone know how to validate whether a schema is a valid schema
Without creating an instance document and then validating that first?

I have code which uses a SAX parser and works when validating an xml
instance document against its schema however Im trying to use this
same code to pass in a schema and the Schema reference and validate one
against the other. e.g.

validate(myXMLDoc, "/home/mySchema.xsd") -- works
valiadte(mySchema, "/home/XMLSchema.xsd") -- fails

Does anyone know if this approach is valid or even if Xerces 2.0.1
Supports validating a schema directly in this way?

The code Im using is listed below. Im getting the following error
when I run it...

"schema_reference.4: Failed to read schema document 'null', because
1) could not find the document; 2) the document could not be read; 3) the
root element of the document is not <xsd:schema."

...even though the document does exist on the file system, can be
read by my application and does have the root element <xsd:schema> for both

schemas.

Any help anyone can give would be much appreciated.
Cheers

-----------

private static String validationFeat
=                        "
http://xml.org/sax/features/validation";

private static String schemaValidationFeat
=            "
http://apache.org/xml/features/validation/schema";

private static String extSchemaProp
=                        "
http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation
";

private boolean validate(InputSource xmlSource, String schemaURL) {

valid = true;
try {
          SAXParser parser = new SAXParser();

          // configures the xerces parser for schema validation.
          parser.setFeature(validationFeat, true);
          parser.setFeature(schemaValidationFeat, true);

        //validate against the given schemaURL
        parser.setProperty(extSchemaProp, schemaURL);

          // binds custom error handler to parser
          ErrorHandler handler = new ValidatingHandler();
          parser.setErrorHandler (handler);


          // parse (validates) the xml
          parser.parse(xmlSource);

} catch (SAXNotRecognizedException snre) {
System.out.println("SAX not recognised " + snre);

valid = false;
} catch (SAXException se) {
            System.out.println("SAX parser " + se);
            valid = false;
} catch (Exception e) {
System.out.println("error parsing " + e);
valid = false;

}

return valid;
}






_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


---------------------------------------------------------------------
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