You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@apache.org on 2002/09/25 04:50:37 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/parsers IntegratedParserConfiguration.java StandardParserConfiguration.java

andyc       2002/09/24 19:50:37

  Modified:    java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java
               java/src/org/apache/xerces/parsers
                        IntegratedParserConfiguration.java
                        StandardParserConfiguration.java
  Log:
  Made some fixes for the last change which added methods to
  the XMLComponent interface which allows the parser config
  to query preferred default values for settings. However,
  since the XML Schema validator component is created
  dynamically, the parser config would query the default
  settings and overwrite the values set by the application.
  
  I have changed the XML Schema validator so that it doesn't
  try to set default values. This seems to solve the problem.
  This sort of goes against the purpose of the new methods
  in XMLComponent and their intended use but the XML Schema
  validator is so heavy-weight, I'm making an exception in
  this case.
  
  This problem doesn't arise when the components are created
  and added at parser config construction time. It only poses
  a problem when components are created dynamically.
  
  Revision  Changes    Path
  1.108     +10 -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.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- XMLSchemaValidator.java	24 Sep 2002 23:16:03 -0000	1.107
  +++ XMLSchemaValidator.java	25 Sep 2002 02:50:37 -0000	1.108
  @@ -231,9 +231,15 @@
       /** Feature defaults. */
       private static final Boolean[] FEATURE_DEFAULTS = {
           null,
  -        Boolean.TRUE,
  -        Boolean.FALSE,
  -        Boolean.FALSE,
  +        // NOTE: The following defaults are nulled out on purpose.
  +        //       If they are set, then when the XML Schema validator
  +        //       is constructed dynamically, these values may override
  +        //       those set by the application. This goes against the
  +        //       whole purpose of XMLComponent#getFeatureDefault but
  +        //       it can't be helped in this case. -Ac
  +        null, //Boolean.FALSE,
  +        null, //Boolean.FALSE,
  +        null, //Boolean.FALSE,
       };
   
       /** Recognized properties. */
  
  
  
  1.5       +10 -10    xml-xerces/java/src/org/apache/xerces/parsers/IntegratedParserConfiguration.java
  
  Index: IntegratedParserConfiguration.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/IntegratedParserConfiguration.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IntegratedParserConfiguration.java	24 Sep 2002 16:17:33 -0000	1.4
  +++ IntegratedParserConfiguration.java	25 Sep 2002 02:50:37 -0000	1.5
  @@ -189,6 +189,15 @@
                                            XMLGrammarPool grammarPool,
                                            XMLComponentManager parentSettings) {
           super(symbolTable, grammarPool, parentSettings);
  +        
  +        // create components
  +        fNonNSScanner = new XMLDocumentScannerImpl();
  +        fNonNSDTDValidator = new XMLDTDValidator();
  +
  +        // add components
  +        addComponent((XMLComponent)fNonNSScanner);
  +        addComponent((XMLComponent)fNonNSDTDValidator);
  +
       } // <init>(SymbolTable,XMLGrammarPool)
   
       
  @@ -249,15 +258,6 @@
                   fLastComponent = fDTDValidator;
               } 
               else {
  -                if (fNonNSScanner == null) {
  -                    fNonNSScanner = new XMLDocumentScannerImpl();
  -                    addComponent((XMLComponent)fNonNSScanner);
  -                }
  -                if (fNonNSDTDValidator == null) {
  -                    fNonNSDTDValidator = new XMLDTDValidator();
  -                    addComponent((XMLComponent)fNonNSDTDValidator);
  -                }
  -
                   fScanner = fNonNSScanner;
                   fProperties.put(DTD_VALIDATOR, fNonNSDTDValidator);
                   fProperties.put(DOCUMENT_SCANNER, fNonNSScanner);
  
  
  
  1.26      +32 -2     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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- StandardParserConfiguration.java	19 Sep 2002 17:51:10 -0000	1.25
  +++ StandardParserConfiguration.java	25 Sep 2002 02:50:37 -0000	1.26
  @@ -135,13 +135,27 @@
       protected static final String XMLSCHEMA_VALIDATION = 
       Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE;
   
  +    /** feature identifier: XML Schema validation -- full checking */
  +    protected static final String XMLSCHEMA_FULL_CHECKING = 
  +    Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_FULL_CHECKING;
  +
       // property identifiers
   
       /** Property identifier: XML Schema validator. */
       protected static final String SCHEMA_VALIDATOR =
           Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_VALIDATOR_PROPERTY;
   
  -
  +    /** Property identifier: schema location. */
  +    protected static final String SCHEMA_LOCATION =
  +    Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_LOCATION;
  +
  +    /** Property identifier: no namespace schema location. */
  +    protected static final String SCHEMA_NONS_LOCATION =
  +    Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_NONS_LOCATION;
  +
  +    /** Property identifier: JAXP schema source. */
  +    protected static final String JAXP_SCHEMA_SOURCE =
  +    Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_SOURCE;
   
       // debugging
   
  @@ -213,6 +227,12 @@
               NORMALIZE_DATA,
               SCHEMA_ELEMENT_DEFAULT,
               SCHEMA_AUGMENT_PSVI, 
  +            // 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
  +            //       not-recognized exception to be thrown. -Ac
  +            XMLSCHEMA_VALIDATION,
  +            XMLSCHEMA_FULL_CHECKING,
           };
           addRecognizedFeatures(recognizedFeatures);
   
  @@ -223,6 +243,16 @@
   
           // add default recognized properties
       
  +        final String[] recognizedProperties = {
  +            // NOTE: These shouldn't really be here but since the XML Schema
  +            //       validator is constructed dynamically, its recognized
  +            //       properties might not have been set and it would cause a
  +            //       not-recognized exception to be thrown. -Ac
  +            SCHEMA_LOCATION,
  +            SCHEMA_NONS_LOCATION,
  +            JAXP_SCHEMA_SOURCE,
  +        };
  +
       } // <init>(SymbolTable,XMLGrammarPool)
   
       //
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org