You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2002/03/01 12:57:11 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java
neeraj 02/03/01 03:57:11
Modified: java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java
Log:
Now we defer the loading of schema specified through externalSchema and
noNamespaceExternalSchema location proerties, the specified grammar from
particular namespace is loaded only when there is reference to any component from that
namespace.
Revision Changes Path
1.45 +22 -19 xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Index: XMLSchemaValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- XMLSchemaValidator.java 27 Feb 2002 17:30:32 -0000 1.44
+++ XMLSchemaValidator.java 1 Mar 2002 11:57:11 -0000 1.45
@@ -133,7 +133,7 @@
* @author Elena Litani IBM
* @author Andy Clark IBM
* @author Neeraj Bajaj, Sun Microsystems, inc.
- * @version $Id: XMLSchemaValidator.java,v 1.44 2002/02/27 17:30:32 neeraj Exp $
+ * @version $Id: XMLSchemaValidator.java,v 1.45 2002/03/01 11:57:11 neeraj Exp $
*/
public class XMLSchemaValidator
implements XMLComponent, XMLDocumentFilter, FieldActivator {
@@ -1190,6 +1190,10 @@
// clear things in substitution group handler
fSubGroupHandler.reset();
+ //REVISIT: we are passing externalSchema and noNamespaceExternalSchema locations to XSDHandler , where
+ //it stores namespace and location values.. now we are doing the same in XMLSchemaValidator,
+ //we can pass the refernce of fLocationPairs and noNamespaceLocationPairs -nb
+
// reset schema handler and all traversal objects
fSchemaHandler.reset(fXSIErrorReporter.fErrorReporter,
fEntityResolver, fSymbolTable,
@@ -1597,8 +1601,15 @@
// thus we will not validate in the case dynamic feature is on or we found dtd grammar
fDoValidation = fValidation && !(fValidationManager.isGrammarFound() || fDynamicValidation);
+
+ //store the external schema locations, these locations will be set at root element, so any other
+ // schemaLocation declaration for the same namespace will be effectively ignored.. becuase we
+ // choose to take first location hint available for a particular namespace.
+
+ storeLocations(fExternalSchemas, fExternalNoNamespaceSchema) ;
+
// parse schemas specified via schema location properties
- parseSchemas(fExternalSchemas, fExternalNoNamespaceSchema);
+ //parseSchemas(fExternalSchemas, fExternalNoNamespaceSchema);
}
fCurrentPSVI = (ElementPSVImpl)augs.getItem(Constants.ELEMENT_PSVI);
@@ -2132,34 +2143,26 @@
//this is the function where logic of retrieving grammar is written , parser first tries to get the grammar from
//the local pool, if not in local pool, it gives chance to application to be able to retrieve the grammar, then it
//tries to parse the grammar using location hints from the give namespace.
- SchemaGrammar findSchemaGrammar(short contextType , String namespace , QName enclosingElement, QName triggeringComponet, XMLAttributes attributes ){
-
- SchemaGrammar grammar = null ;
-
+ SchemaGrammar findSchemaGrammar(short contextType , String namespace , QName enclosingElement, QName triggeringComponet, XMLAttributes attributes ){
+ SchemaGrammar grammar = null ;
//get the grammar from local pool...
- grammar = fGrammarBucket.getGrammar(namespace);
-
+ grammar = fGrammarBucket.getGrammar(namespace);
if( grammar == null){
// give a chance to application to be able to retreive the grammar.
- grammar = getSchemaGrammarFromAppl( contextType , namespace , enclosingElement , triggeringComponet , attributes);
-
+ grammar = getSchemaGrammarFromAppl( contextType , namespace , enclosingElement , triggeringComponet , attributes);
if(grammar == null){
// try to parse the grammar using location hints from that namespace..
grammar = parseSchema(namespace , contextType);
}
else{
- return grammar ;
-
- }
-
+ return grammar ;
+ }
}
else{
return grammar ;
- }
-
- return grammar ;
-
-
+ }
+ return grammar ;
+
}//findSchemaGrammar
// give a chance to application to be able to retreive the grammar.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org