ankitp      2005/02/09 07:34:03

  Modified:    java/src/org/apache/xerces/parsers XML11Configuration.java
                        StandardParserConfiguration.java
               java/src/org/apache/xerces/impl/xs XMLSchemaLoader.java
                        XMLSchemaValidator.java
               java/src/org/apache/xerces/impl Constants.java
               java/src/org/apache/xerces/impl/xs/traversers
                        XSDHandler.java
  Log:
  refactoring. changing feature to: 
http://apache.org/xml/features/honour-all-schemaLocations
  
  Revision  Changes    Path
  1.22      +5 -5      
xml-xerces/java/src/org/apache/xerces/parsers/XML11Configuration.java
  
  Index: XML11Configuration.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/XML11Configuration.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- XML11Configuration.java   8 Feb 2005 15:29:22 -0000       1.21
  +++ XML11Configuration.java   9 Feb 2005 15:34:02 -0000       1.22
  @@ -143,9 +143,9 @@
       protected static final String VALIDATE_ANNOTATIONS =
           Constants.XERCES_FEATURE_PREFIX + 
Constants.VALIDATE_ANNOTATIONS_FEATURE;
       
  -    /** Feature identifier: handle multiple imports. */
  -    protected static final String HANDLE_MULTIPLE_IMPORTS = 
  -        Constants.XERCES_FEATURE_PREFIX + 
Constants.HANDLE_MULTIPLE_IMPORTS_FEATURE;
  +    /** Feature identifier: honour all schemaLocations */
  +    protected static final String HONOUR_ALL_SCHEMALOCATIONS = 
  +        Constants.XERCES_FEATURE_PREFIX + 
Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
           
        // feature identifiers
   
  @@ -443,7 +443,7 @@
                                NAMESPACES,
                   NORMALIZE_DATA, SCHEMA_ELEMENT_DEFAULT, SCHEMA_AUGMENT_PSVI,
                   GENERATE_SYNTHETIC_ANNOTATIONS, VALIDATE_ANNOTATIONS,
  -                HANDLE_MULTIPLE_IMPORTS,
  +                HONOUR_ALL_SCHEMALOCATIONS,
                // NOTE: These shouldn't really be here but since the XML Schema
                //       validator is constructed dynamically, its recognized
                //       features might not have been set and it would cause a
  @@ -466,7 +466,7 @@
                fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE);
           fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
           fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE);
  -        fFeatures.put(HANDLE_MULTIPLE_IMPORTS, Boolean.FALSE);
  +        fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE);
                fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
   
           // add default recognized properties
  
  
  
  1.38      +5 -5      
xml-xerces/java/src/org/apache/xerces/parsers/StandardParserConfiguration.java
  
  Index: StandardParserConfiguration.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/StandardParserConfiguration.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- StandardParserConfiguration.java  8 Feb 2005 15:29:22 -0000       1.37
  +++ StandardParserConfiguration.java  9 Feb 2005 15:34:02 -0000       1.38
  @@ -99,9 +99,9 @@
       protected static final String VALIDATE_ANNOTATIONS =
           Constants.XERCES_FEATURE_PREFIX + 
Constants.VALIDATE_ANNOTATIONS_FEATURE;
       
  -    /** Feature identifier: handle multiple imports. */
  -    protected static final String HANDLE_MULTIPLE_IMPORTS = 
  -        Constants.XERCES_FEATURE_PREFIX + 
Constants.HANDLE_MULTIPLE_IMPORTS_FEATURE;
  +    /** Feature identifier: honour all schemaLocations */
  +    protected static final String HONOUR_ALL_SCHEMALOCATIONS = 
  +        Constants.XERCES_FEATURE_PREFIX + 
Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
   
       // property identifiers
   
  @@ -184,7 +184,7 @@
               SCHEMA_AUGMENT_PSVI,
               GENERATE_SYNTHETIC_ANNOTATIONS,
               VALIDATE_ANNOTATIONS,
  -            HANDLE_MULTIPLE_IMPORTS,
  +            HONOUR_ALL_SCHEMALOCATIONS,
               // NOTE: These shouldn't really be here but since the XML Schema
               //       validator is constructed dynamically, its recognized
               //       features might not have been set and it would cause a
  @@ -200,7 +200,7 @@
           setFeature(SCHEMA_AUGMENT_PSVI, true);
           setFeature(GENERATE_SYNTHETIC_ANNOTATIONS, false);
           setFeature(VALIDATE_ANNOTATIONS, false);
  -        setFeature(HANDLE_MULTIPLE_IMPORTS, false);
  +        setFeature(HONOUR_ALL_SCHEMALOCATIONS, false);
   
           // add default recognized properties
       
  
  
  
  1.38      +22 -7     
xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
  
  Index: XMLSchemaLoader.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- XMLSchemaLoader.java      8 Feb 2005 15:29:23 -0000       1.37
  +++ XMLSchemaLoader.java      9 Feb 2005 15:34:02 -0000       1.38
  @@ -122,10 +122,9 @@
       protected static final String GENERATE_SYNTHETIC_ANNOTATIONS = 
           Constants.XERCES_FEATURE_PREFIX + 
Constants.GENERATE_SYNTHETIC_ANNOTATIONS_FEATURE;
       
  -    /** Feature identifier: handle multiple imports. */
  -    protected static final String HANDLE_MULTIPLE_IMPORTS = 
  -        Constants.XERCES_FEATURE_PREFIX + 
Constants.HANDLE_MULTIPLE_IMPORTS_FEATURE;
  -    
  +    /** Feature identifier: honour all schemaLocations */
  +    protected static final String HONOUR_ALL_SCHEMALOCATIONS = 
  +        Constants.XERCES_FEATURE_PREFIX + 
Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
       
       protected static final String AUGMENT_PSVI = 
           Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_AUGMENT_PSVI;
  @@ -143,7 +142,7 @@
           DISALLOW_DOCTYPE,
           GENERATE_SYNTHETIC_ANNOTATIONS,
           VALIDATE_ANNOTATIONS,
  -        HANDLE_MULTIPLE_IMPORTS
  +        HONOUR_ALL_SCHEMALOCATIONS
       };
       
       // property identifiers
  @@ -469,6 +468,22 @@
           return fUserEntityResolver;
       } // getEntityResolver():  XMLEntityResolver
       
  +    /**
  +     * 
  +     * @param source[]  the locations of the entity which forms 
  +     *                      the staring point of the grammars to be 
constructed
  +     * @throws IOException  when a problem is encounted reading the entity
  +     * @throws XNIException when a condition arises (such as a FatalErro) 
that requires parsing
  +     *                          of the entity be terminated
  +     */
  +    //Notes: so far, we assume one grammar won't come from multiple 
sources--Jack
  +    public void loadGrammar(XMLInputSource source[]) 
  +    throws IOException, XNIException{
  +        int numSource = source.length;
  +        for(int i = 0; i < numSource; i++){
  +            loadGrammar(source[i]);
  +        }   
  +    }
       
       /**
        * Returns a Grammar object by parsing the contents of the
  @@ -1106,7 +1121,7 @@
                   name.equals(ALLOW_JAVA_ENCODINGS) ||
                   name.equals(STANDARD_URI_CONFORMANT_FEATURE) ||
                   name.equals(GENERATE_SYNTHETIC_ANNOTATIONS) ||
  -                name.equals(HANDLE_MULTIPLE_IMPORTS)) {
  +                name.equals(HONOUR_ALL_SCHEMALOCATIONS)) {
                   return true;
                   
               }
  @@ -1181,7 +1196,7 @@
               v.add(STANDARD_URI_CONFORMANT_FEATURE);
               v.add(VALIDATE_ANNOTATIONS);
               v.add(GENERATE_SYNTHETIC_ANNOTATIONS);
  -            v.add(HANDLE_MULTIPLE_IMPORTS);
  +            v.add(HONOUR_ALL_SCHEMALOCATIONS);
               fRecognizedParameters = new DOMStringListImpl(v);        
           }
           return fRecognizedParameters;
  
  
  
  1.165     +4 -4      
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.164
  retrieving revision 1.165
  diff -u -r1.164 -r1.165
  --- XMLSchemaValidator.java   8 Feb 2005 15:29:23 -0000       1.164
  +++ XMLSchemaValidator.java   9 Feb 2005 15:34:02 -0000       1.165
  @@ -151,9 +151,9 @@
       protected static final String VALIDATE_ANNOTATIONS =
           Constants.XERCES_FEATURE_PREFIX + 
Constants.VALIDATE_ANNOTATIONS_FEATURE;
       
  -    /** Feature identifier: handle multiple imports. */
  -    protected static final String HANDLE_MULTIPLE_IMPORTS = 
  -        Constants.XERCES_FEATURE_PREFIX + 
Constants.HANDLE_MULTIPLE_IMPORTS_FEATURE;
  +    /** Feature identifier: honour all schemaLocations */
  +    protected static final String HONOUR_ALL_SCHEMALOCATIONS = 
  +        Constants.XERCES_FEATURE_PREFIX + 
Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
   
       /** Feature identifier: whether to continue parsing a schema after a 
fatal error is encountered */
       protected static final String CONTINUE_AFTER_FATAL_ERROR =
  @@ -216,7 +216,7 @@
               STANDARD_URI_CONFORMANT_FEATURE,
               GENERATE_SYNTHETIC_ANNOTATIONS,
               VALIDATE_ANNOTATIONS,
  -            HANDLE_MULTIPLE_IMPORTS};
  +            HONOUR_ALL_SCHEMALOCATIONS};
   
       /** Feature defaults. */
       private static final Boolean[] FEATURE_DEFAULTS = { null,
  
  
  
  1.48      +2 -2      xml-xerces/java/src/org/apache/xerces/impl/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Constants.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- Constants.java    8 Feb 2005 15:31:40 -0000       1.47
  +++ Constants.java    9 Feb 2005 15:34:03 -0000       1.48
  @@ -122,8 +122,8 @@
       /** JAXP schemaSource property: when used internally may include DTD 
sources (DOM) */
       public static final String SCHEMA_SOURCE = "schemaSource";
       
  -    /** Multiple imports feature */
  -    public static final String HANDLE_MULTIPLE_IMPORTS_FEATURE = 
"handle-multiple-imports";
  +    /** Honour all schemaLocations (multiple imports etc) feature */
  +    public static final String HONOUR_ALL_SCHEMALOCATIONS_FEATURE = 
"honour-all-schemaLocations";
       
       /** JAXP schemaSource language: when used internally may include DTD 
namespace (DOM) */
       public static final String SCHEMA_LANGUAGE = "schemaLanguage";
  
  
  
  1.87      +10 -10    
xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
  
  Index: XSDHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- XSDHandler.java   8 Feb 2005 15:29:23 -0000       1.86
  +++ XSDHandler.java   9 Feb 2005 15:34:03 -0000       1.87
  @@ -112,9 +112,9 @@
       protected static final String VALIDATE_ANNOTATIONS =
           Constants.XERCES_FEATURE_PREFIX + 
Constants.VALIDATE_ANNOTATIONS_FEATURE;
       
  -    /** Feature identifier: handle multiple imports. */
  -    protected static final String HANDLE_MULTIPLE_IMPORTS = 
  -        Constants.XERCES_FEATURE_PREFIX + 
Constants.HANDLE_MULTIPLE_IMPORTS_FEATURE;
  +    /** Feature identifier: honour all schemaLocations */
  +    protected static final String HONOUR_ALL_SCHEMALOCATIONS = 
  +        Constants.XERCES_FEATURE_PREFIX + 
Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
       
       /** Property identifier: error handler. */
       protected static final String ERROR_HANDLER =
  @@ -271,7 +271,7 @@
       private boolean fValidateAnnotations = false;
       
       //handle multiple import feature
  -    private boolean fHandleMultipleImports = false;
  +    private boolean fHonourAllSchemaLocations = false;
   
       // the XMLErrorReporter
       private XMLErrorReporter fErrorReporter;
  @@ -387,7 +387,7 @@
           // no namespace schema.
           if (referType != XSDDescription.CONTEXT_PREPARSE){
               // first try to find it in the bucket/pool, return if one is 
found
  -            if(fHandleMultipleImports && referType == 
XSDDescription.CONTEXT_IMPORT && isExistingGrammar(desc)) {
  +            if(fHonourAllSchemaLocations && referType == 
XSDDescription.CONTEXT_IMPORT && isExistingGrammar(desc)) {
                   grammar = 
fGrammarBucket.getGrammar(desc.getTargetNamespace());
               }
               else {
  @@ -676,7 +676,7 @@
                   referType == XSDDescription.CONTEXT_REDEFINE) {
               sg = fGrammarBucket.getGrammar(currSchemaInfo.fTargetNamespace);
           }
  -        else if(fHandleMultipleImports && referType == 
XSDDescription.CONTEXT_IMPORT) {
  +        else if(fHonourAllSchemaLocations && referType == 
XSDDescription.CONTEXT_IMPORT) {
               sg = findGrammar(desc);
               if(sg == null) {
                   sg = new SchemaGrammar(currSchemaInfo.fTargetNamespace, 
desc.makeClone(), fSymbolTable);
  @@ -750,7 +750,7 @@
                   // if this namespace has not been imported by this document,
                   //  then import if multiple imports support is enabled.
                   if(currSchemaInfo.isAllowedNS(schemaNamespace)) {
  -                    if(!fHandleMultipleImports)
  +                    if(!fHonourAllSchemaLocations)
                           continue;
                   }
                   else  {
  @@ -781,7 +781,7 @@
                   
                   // if a grammar with the same namespace and location exists 
(or being
                   // built), ignore this one (don't traverse it).
  -                if ((!fHandleMultipleImports && 
findGrammar(fSchemaGrammarDescription) != null) || 
isExistingGrammar(fSchemaGrammarDescription))
  +                if ((!fHonourAllSchemaLocations && 
findGrammar(fSchemaGrammarDescription) != null) || 
isExistingGrammar(fSchemaGrammarDescription))
                       continue;
                   newSchemaRoot = resolveSchema(fSchemaGrammarDescription, 
false, child);
               }
  @@ -1742,9 +1742,9 @@
           }
           
           try {
  -            fHandleMultipleImports = 
componentManager.getFeature(HANDLE_MULTIPLE_IMPORTS);
  +            fHonourAllSchemaLocations = 
componentManager.getFeature(HONOUR_ALL_SCHEMALOCATIONS);
           } catch (XMLConfigurationException e) {
  -            fHandleMultipleImports = false;
  +            fHonourAllSchemaLocations = false;
           }
   
           try {
  
  
  

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

Reply via email to