Hi,

thank you all for these interesting thoughts!

Gareth (now Chair of of Apache Xerces Project Management Committee) stated
that Xerces does not claim to validate Schemas and that I should hence try
another
tool.
(http://blog.parthenoncomputing.com/xerces/archives/2005/04/can_i_validate.html)

Jeff had the idea of using the grammar preparsing mechanism to validate
schemas. I like the idea from the point of view that I want to benchmark
Xerces validation performance in a B2B scenario.
Therefore precaching is imho required anyway for increased performance in
message validation.

The benchmark however relies on the XML Schema test collection available
here (http://www.w3.org/2001/05/xmlschema-test-collection.html). In the
past, xerces (2.0.0_beta4) was only tested in test cases that involved a
schema and an instance. 

Please share with me your thoughts on:
1. ) Did anybody try to run the W3C schema-only test cases on Xerces (using
the precaching framework)?
2. ) Is the precaching framework suitable for running the above benchmark?
3. ) Will Schema validation be added to Xerces (the last question is
interesting for the "outlook"-part of my paper since I want to compare
Xerces with an OpenSource Tool developed by my company).

Thank you Gareth, Jeff and Bob for your previous answers.

Kind Regards,

Gregor

@Gareth: This is how I came up with the idea of using the Schema for Schema
with Xerces (it was silly, but I gave it a try :-)
>From XSV homepage (http://www.w3.org/2001/03/webdata/xsv)

...This means that if the only input is a schema document, XSV normally just
validates that document against the Schema for Schema Documents
(XMLSchema.xsd), but does not also check the Schema REC's constraints on the
corresponding schema...




> Xerces will validate your schema if you cause it to be parsed with the 
> appropriate parser features set.  The necessary features are discussed 
> on the Features page of the documentation and the XML Schema FAQ.  You 
> can force the schema to be read
>   1.  by parsing an instance document whose root element is in the 
> namespace of your schema (and one of the typical means is specified for 
> the parser to find the schema for that namespace)  or
>   2.  by using the grammar preparsing mechanism (see the Caching and 
> Preparsing Grammars FAQ)
> 
> The validation features set in the parser determine which constratints 
> on the schema are checked.  You should almost certainly provide a custom 
> error handler to the parser to get good error reporting. 
> 
> You don't need to worry about the schema-for-schemas.  Xerces treats 
> that as a built-in. 
> 
> All the doc pages mentioned can be accessed from the root of the xerces 
> documentation tree.
> 
> Jeff
> 
> Bob Schloss wrote:
> 
> >Be aware that not all the constraints which XML Schemas must follow can
> be
> >syntactically checked only using the Schema for XML Schema.
> >
> >You may want to process your schema with some very complete Schema
> checking
> >tool.  See, for example, the XML Schema Quality Checker located on IBM
> >alphaWorks [1] or XSV [2].
> >
> >Bob
> >
> >[1] http://www.alphaworks.ibm.com/tech/xmlsqc
> >[2] http://www.w3.org/2001/03/webdata/xsv
> >
> >
> >
> >
> >                                                                         
>  
> >             "Gregor"                                                    
>  
> >             <[EMAIL PROTECTED]                                           
>  
> >             an.com>                                                   
> To 
> >                                       [EMAIL PROTECTED]      
>  
> >             04/14/2005 01:49                                          
> cc 
> >             AM                                                          
>  
> >                                                                  
> Subject 
> >                                       How to validate an XSD File       
>  
> >             Please respond to         (validating a (not against a)     
>  
> >               xerces-j-user           Schema)                           
>  
> >                                                                         
>  
> >                                                                         
>  
> >                                                                         
>  
> >                                                                         
>  
> >                                                                         
>  
> >                                                                         
>  
> >
> >
> >
> >
> >Hello,
> >
> >I am trying to validate Schema files using Xerces.
> >
> >The problem is, that I only got one XML Schema file e.g. attA001.xsd
> (some
> >will now, this is the W3Cs Schema-test-collection
> >http://www.w3.org/2001/05/xmlschema-test-collection.html) and want to
> tell
> >whether it is a valid XML Schema according to XML Schema recommendation
> or
> >an invalid one.
> >
> >I tried the following approaches:
> >
> >1.) Download the Schema-for-Schemas from the W3Cs Website
> >("http://www.w3.org/2001/XMLSchema.xsd";) and validating attA001.xsd
> against
> >this file as if attA001.xsd was an instance (which technically in my
> >understanding it is) of XMLSchema.xsd
> >(Please see code snippet below)
> >(Before doing that I validated the XMLSchema.xsd against its own internal
> >dtd which worked just fine)
> >
> >2.) Validate an empty file specifing attA001.xsd as Schema file for it
> >(hope
> >it would appart from empty file err also point to errors in the schema
> >(..schema-full-checking", true); but it did not.
> >
> >I ran out of ideas at some point yesterday night.
> >
> >I am very thankfull for any suggestions.
> >
> >Kind Regards,
> >
> >Gregor
> >
> >1.) Code Snippet
> >This is the setup: (try/catch omitted for legibility)
> >
> >SAXParserFactory factory = SAXParserFactory.newInstance();
> >
> >SAXParser parser = factory.newSAXParser();
> >
> >XMLReader reader = parser.getXMLReader();
> >
> >reader.setFeature("http://xml.org/sax/features/namespaces";, true);
> >             reader.setFeature("
> >http://xml.org/sax/features/namespace-prefixes";,
> >true);
> >
> >reader.setFeature("http://xml.org/sax/features/validation";, true);
> >
> >reader.setFeature("http://apache.org/xml/features/validation/schema";,
> >true);
> >
> >reader.setFeature("
> >http://apache.org/xml/features/validation/schema-full-checking";,
> >true);
> >
> >Validator handler=new Validator();
> >reader.setErrorHandler(handler);
> >
> >parser.setProperty
> >("http://java.sun.com/xml/jaxp/properties/schemaLanguage";,
> >    "http://www.w3.org/2001/XMLSchema";);
> >
>
>parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource";,
> >                                     "C:/test/XMLSchema.xsd");
> >
> >parser.parse(SchemaUri, handler);
> >//SchemaUri = "C:/test/attA001.xsd"
> >
> >This is the errorMsg:
> >
> > s4s-elt-invalid-content.1: The content of '#AnonType_documentation' is
> >invalid.  Element 'attribute' is invalid, misplaced, or occurs too often.
> >
> >Line Number:1277
> >
> >I can not find the specified element and I get the same error for many
> xsds
> >I am trying to validate (even the ones supposed to be valid according to
> >W3Cs XML Schema test collection)
> >
> >---------------------------------------------------------------------
> >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]
> >
> >
> >
> >  
> >
> 
> 
> ---------------------------------------------------------------------
> 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