andyc 2002/09/24 02:39:45 Modified: java/docs releases.xml java/samples/xni PSVIWriter.java Writer.java java/src/org/apache/xerces/impl XMLDTDScannerImpl.java XMLDocumentFragmentScannerImpl.java XMLDocumentScannerImpl.java XMLEntityManager.java XMLErrorReporter.java XMLNamespaceBinder.java java/src/org/apache/xerces/impl/dtd XMLDTDProcessor.java XMLDTDValidator.java java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java java/src/org/apache/xerces/parsers BasicParserConfiguration.java DTDConfiguration.java NonValidatingConfiguration.java java/src/org/apache/xerces/xni/parser XMLComponent.java Log: 1) Added methods to XMLComponent so that parser configurations can query the preferred default values for settings. Also modified all of the classes that implement or use this interface to take advantage of the new calls. 2) Removed extraneous output from xni.Writer sample. Revision Changes Path 1.135 +23 -8 xml-xerces/java/docs/releases.xml Index: releases.xml =================================================================== RCS file: /home/cvs/xml-xerces/java/docs/releases.xml,v retrieving revision 1.134 retrieving revision 1.135 diff -u -r1.134 -r1.135 --- releases.xml 29 Aug 2002 16:07:00 -0000 1.134 +++ releases.xml 24 Sep 2002 09:39:43 -0000 1.135 @@ -1,8 +1,23 @@ -<?xml version='1.0' encoding='UTF-8'?> +<?xml version='1.0' encoding='UTF-8'?> <!-- $Id$ --> <!DOCTYPE releases SYSTEM 'dtd/releases.dtd'> <releases> - <release version="2.1"> + <release version="&ParserName; 2.2.0"> + <desc> + </desc> + <changes> + <update> + <note> + Modified XMLComponent interface so that components used + in a parser configuration can specify preferred default + values for settings. Also updated all classes that + implement the XMLComponent interface. + </note> + <submitter name='Andy Clark'/> + </update> + </changes> + </release> + <release version="&ParserName; 2.1.0"> <desc> As well as some relatively minor changes to XNI, this release includes many bugfixes and performance improvements. @@ -120,7 +135,7 @@ </fix> </changes> </release> - <release version="2.0.2"> + <release version="&ParserName; 2.0.2"> <desc> In this release, numerous bugs have been fixed. Only one minor change in the Xerces Native Interface is included (documented below); considerable @@ -362,7 +377,7 @@ </changes> </release> - <release version='Xerces 2.0.1'> + <release version='&ParserName; 2.0.1'> <desc> This release fixes a number of bugs. </desc> @@ -479,7 +494,7 @@ </changes> </release> - <release version='Xerces 2.0.0'> + <release version='&ParserName; 2.0.0'> <desc> This is the first production-quality release of the Xerces2 Java XML parser. We are confident that it also marks the stabilization @@ -697,7 +712,7 @@ </release> - <release version='Xerces 2.0.0 (beta4)'> + <release version='&ParserName; 2.0.0 (beta4)'> <desc> This release fixes a number of bugs, introduces more changes to the Xerces Native Interface, provides partial experimental DOM Level 3 implementation, @@ -911,7 +926,7 @@ </changes> </release> - <release version='Xerces 2.0.0 (beta3)'> + <release version='&ParserName; 2.0.0 (beta3)'> <desc> This release fixes a number of bugs, introduces some changes to the Xerces Native Interface, and is the first Xerces2 release to 1.11 +52 -3 xml-xerces/java/samples/xni/PSVIWriter.java Index: PSVIWriter.java =================================================================== RCS file: /home/cvs/xml-xerces/java/samples/xni/PSVIWriter.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- PSVIWriter.java 16 Aug 2002 18:13:31 -0000 1.10 +++ PSVIWriter.java 24 Sep 2002 09:39:43 -0000 1.11 @@ -136,16 +136,29 @@ protected boolean fIncludeIgnorableWhitespace; /** Recognized features. */ - protected static final String[] RECOGNIZED_FEATURES = { + private static final String[] RECOGNIZED_FEATURES = { NAMESPACE_BINDER, INCLUDE_IGNORABLE_WHITESPACE, // PSVINFOSET, }; + + /** Feature defaults. */ + private static final Boolean[] FEATURE_DEFAULTS = { + Boolean.TRUE, // ??? + Boolean.TRUE, // ??? + // ??? + }; + /** Recognized properties. */ - protected static final String[] RECOGNIZED_PROPERTIES={ + private static final String[] RECOGNIZED_PROPERTIES={ SYMBOL_TABLE, }; + /** Property defaults. */ + private static final Object[] PROPERTY_DEFAULTS = { + null, + }; + /** PSVInfoset */ protected boolean fPSVInfoset; @@ -305,6 +318,42 @@ throws XMLConfigurationException { } // setProperty(String,Object) + + /** + * Returns the default state for a feature, or null if this + * component does not want to report a default value for this + * feature. + * + * @param featureId The feature identifier. + * + * @since Xerces 2.2.0 + */ + public Boolean getFeatureDefault(String featureId) { + for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { + if (RECOGNIZED_FEATURES[i].equals(featureId)) { + return FEATURE_DEFAULTS[i]; + } + } + return null; + } // getFeatureDefault(String):Boolean + + /** + * Returns the default state for a property, or null if this + * component does not want to report a default value for this + * property. + * + * @param propertyId The property identifier. + * + * @since Xerces 2.2.0 + */ + public Object getPropertyDefault(String propertyId) { + for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { + if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { + return PROPERTY_DEFAULTS[i]; + } + } + return null; + } // getPropertyDefault(String):Object // // XMLDocumentSource methods 1.13 +2 -2 xml-xerces/java/samples/xni/Writer.java Index: Writer.java =================================================================== RCS file: /home/cvs/xml-xerces/java/samples/xni/Writer.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Writer.java 11 Sep 2002 14:13:08 -0000 1.12 +++ Writer.java 24 Sep 2002 09:39:43 -0000 1.13 @@ -304,7 +304,7 @@ public void characters(XMLString text, Augmentations augs) throws XNIException { normalizeAndPrint(text); - fOut.println("one call..."); + //fOut.println("one call..."); fOut.flush(); } // characters(XMLString,Augmentations) 1.31 +50 -1 xml-xerces/java/src/org/apache/xerces/impl/XMLDTDScannerImpl.java Index: XMLDTDScannerImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDTDScannerImpl.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- XMLDTDScannerImpl.java 20 Sep 2002 01:03:24 -0000 1.30 +++ XMLDTDScannerImpl.java 24 Sep 2002 09:39:43 -0000 1.31 @@ -132,6 +132,12 @@ NOTIFY_CHAR_REFS, }; + /** Feature defaults. */ + private static final Boolean[] FEATURE_DEFAULTS = { + null, + Boolean.FALSE, + }; + /** Recognized properties. */ private static final String[] RECOGNIZED_PROPERTIES = { SYMBOL_TABLE, @@ -139,6 +145,13 @@ ENTITY_MANAGER, }; + /** Property defaults. */ + private static final Object[] PROPERTY_DEFAULTS = { + null, + null, + null, + }; + // debugging /** Debug scanner state. */ @@ -412,6 +425,42 @@ public String[] getRecognizedProperties() { return (String[])(RECOGNIZED_PROPERTIES.clone()); } // getRecognizedProperties():String[] + + /** + * Returns the default state for a feature, or null if this + * component does not want to report a default value for this + * feature. + * + * @param featureId The feature identifier. + * + * @since Xerces 2.2.0 + */ + public Boolean getFeatureDefault(String featureId) { + for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { + if (RECOGNIZED_FEATURES[i].equals(featureId)) { + return FEATURE_DEFAULTS[i]; + } + } + return null; + } // getFeatureDefault(String):Boolean + + /** + * Returns the default state for a property, or null if this + * component does not want to report a default value for this + * property. + * + * @param propertyId The property identifier. + * + * @since Xerces 2.2.0 + */ + public Object getPropertyDefault(String propertyId) { + for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { + if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { + return PROPERTY_DEFAULTS[i]; + } + } + return null; + } // getPropertyDefault(String):Object // // XMLDTDSource methods 1.22 +52 -1 xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java Index: XMLDocumentFragmentScannerImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- XMLDocumentFragmentScannerImpl.java 16 Sep 2002 21:25:30 -0000 1.21 +++ XMLDocumentFragmentScannerImpl.java 24 Sep 2002 09:39:44 -0000 1.22 @@ -174,6 +174,14 @@ NOTIFY_CHAR_REFS, }; + /** Feature defaults. */ + private static final Boolean[] FEATURE_DEFAULTS = { + null, + null, + Boolean.FALSE, + Boolean.FALSE, + }; + /** Recognized properties. */ private static final String[] RECOGNIZED_PROPERTIES = { SYMBOL_TABLE, @@ -181,6 +189,13 @@ ENTITY_MANAGER, }; + /** Property defaults. */ + private static final Object[] PROPERTY_DEFAULTS = { + null, + null, + null, + }; + // debugging /** Debug scanner state. */ @@ -472,6 +487,42 @@ } } // setProperty(String,Object) + + /** + * Returns the default state for a feature, or null if this + * component does not want to report a default value for this + * feature. + * + * @param featureId The feature identifier. + * + * @since Xerces 2.2.0 + */ + public Boolean getFeatureDefault(String featureId) { + for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { + if (RECOGNIZED_FEATURES[i].equals(featureId)) { + return FEATURE_DEFAULTS[i]; + } + } + return null; + } // getFeatureDefault(String):Boolean + + /** + * Returns the default state for a property, or null if this + * component does not want to report a default value for this + * property. + * + * @param propertyId The property identifier. + * + * @since Xerces 2.2.0 + */ + public Object getPropertyDefault(String propertyId) { + for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { + if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { + return PROPERTY_DEFAULTS[i]; + } + } + return null; + } // getPropertyDefault(String):Object // // XMLDocumentSource methods 1.24 +65 -10 xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentScannerImpl.java Index: XMLDocumentScannerImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentScannerImpl.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- XMLDocumentScannerImpl.java 16 Sep 2002 21:36:40 -0000 1.23 +++ XMLDocumentScannerImpl.java 24 Sep 2002 09:39:44 -0000 1.24 @@ -163,23 +163,28 @@ /** Recognized features. */ private static final String[] RECOGNIZED_FEATURES = { - NAMESPACES, - VALIDATION, LOAD_EXTERNAL_DTD, - NOTIFY_BUILTIN_REFS, - NOTIFY_CHAR_REFS, + }; + + /** Feature defaults. */ + private static final Boolean[] FEATURE_DEFAULTS = { + Boolean.TRUE, }; /** Recognized properties. */ private static final String[] RECOGNIZED_PROPERTIES = { - SYMBOL_TABLE, - ERROR_REPORTER, - ENTITY_MANAGER, DTD_SCANNER, VALIDATION_MANAGER, NAMESPACE_CONTEXT_PROPERTY }; + /** Property defaults. */ + private static final Object[] PROPERTY_DEFAULTS = { + null, + null, + null, + }; + // // Data // @@ -327,7 +332,14 @@ * are recognized by this component. */ public String[] getRecognizedFeatures() { - return (String[])(RECOGNIZED_FEATURES.clone()); + String[] featureIds = super.getRecognizedFeatures(); + int length = featureIds != null ? featureIds.length : 0; + String[] combinedFeatureIds = new String[length + RECOGNIZED_FEATURES.length]; + if (featureIds == null) { + System.arraycopy(featureIds, 0, combinedFeatureIds, 0, featureIds.length); + } + System.arraycopy(RECOGNIZED_FEATURES, 0, combinedFeatureIds, length, RECOGNIZED_FEATURES.length); + return combinedFeatureIds; } // getRecognizedFeatures():String[] /** @@ -367,7 +379,14 @@ * are recognized by this component. */ public String[] getRecognizedProperties() { - return (String[])(RECOGNIZED_PROPERTIES.clone()); + String[] propertyIds = super.getRecognizedProperties(); + int length = propertyIds != null ? propertyIds.length : 0; + String[] combinedPropertyIds = new String[length + RECOGNIZED_PROPERTIES.length]; + if (propertyIds == null) { + System.arraycopy(propertyIds, 0, combinedPropertyIds, 0, propertyIds.length); + } + System.arraycopy(RECOGNIZED_PROPERTIES, 0, combinedPropertyIds, length, RECOGNIZED_PROPERTIES.length); + return combinedPropertyIds; } // getRecognizedProperties():String[] /** @@ -400,6 +419,42 @@ } } // setProperty(String,Object) + + /** + * Returns the default state for a feature, or null if this + * component does not want to report a default value for this + * feature. + * + * @param featureId The feature identifier. + * + * @since Xerces 2.2.0 + */ + public Boolean getFeatureDefault(String featureId) { + for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { + if (RECOGNIZED_FEATURES[i].equals(featureId)) { + return FEATURE_DEFAULTS[i]; + } + } + return super.getFeatureDefault(featureId); + } // getFeatureDefault(String):Boolean + + /** + * Returns the default state for a property, or null if this + * component does not want to report a default value for this + * property. + * + * @param propertyId The property identifier. + * + * @since Xerces 2.2.0 + */ + public Object getPropertyDefault(String propertyId) { + for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { + if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { + return PROPERTY_DEFAULTS[i]; + } + } + return super.getPropertyDefault(propertyId); + } // getPropertyDefault(String):Object // // XMLEntityHandler methods 1.47 +55 -1 xml-xerces/java/src/org/apache/xerces/impl/XMLEntityManager.java Index: XMLEntityManager.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLEntityManager.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- XMLEntityManager.java 17 Sep 2002 13:08:00 -0000 1.46 +++ XMLEntityManager.java 24 Sep 2002 09:39:44 -0000 1.47 @@ -191,6 +191,15 @@ WARN_ON_DUPLICATE_ENTITYDEF }; + /** Feature defaults. */ + private static final Boolean[] FEATURE_DEFAULTS = { + null, + Boolean.TRUE, + Boolean.TRUE, + Boolean.FALSE, + Boolean.FALSE, + }; + /** Recognized properties. */ private static final String[] RECOGNIZED_PROPERTIES = { SYMBOL_TABLE, @@ -200,6 +209,15 @@ BUFFER_SIZE }; + /** Property defaults. */ + private static final Object[] PROPERTY_DEFAULTS = { + null, + null, + null, + null, + new Integer(DEFAULT_BUFFER_SIZE), + }; + private static final String XMLEntity = "[xml]".intern(); private static final String DTDEntity = "[dtd]".intern(); @@ -1144,6 +1162,42 @@ } } // setProperty(String,Object) + + /** + * Returns the default state for a feature, or null if this + * component does not want to report a default value for this + * feature. + * + * @param featureId The feature identifier. + * + * @since Xerces 2.2.0 + */ + public Boolean getFeatureDefault(String featureId) { + for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { + if (RECOGNIZED_FEATURES[i].equals(featureId)) { + return FEATURE_DEFAULTS[i]; + } + } + return null; + } // getFeatureDefault(String):Boolean + + /** + * Returns the default state for a property, or null if this + * component does not want to report a default value for this + * property. + * + * @param propertyId The property identifier. + * + * @since Xerces 2.2.0 + */ + public Object getPropertyDefault(String propertyId) { + for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { + if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { + return PROPERTY_DEFAULTS[i]; + } + } + return null; + } // getPropertyDefault(String):Object // // Public static methods 1.10 +47 -1 xml-xerces/java/src/org/apache/xerces/impl/XMLErrorReporter.java Index: XMLErrorReporter.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLErrorReporter.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- XMLErrorReporter.java 17 Jul 2002 21:30:11 -0000 1.9 +++ XMLErrorReporter.java 24 Sep 2002 09:39:44 -0000 1.10 @@ -160,11 +160,21 @@ CONTINUE_AFTER_FATAL_ERROR, }; + /** Feature defaults. */ + private static final Boolean[] FEATURE_DEFAULTS = { + null, + }; + /** Recognized properties. */ private static final String[] RECOGNIZED_PROPERTIES = { ERROR_HANDLER, }; + /** Property defaults. */ + private static final Object[] PROPERTY_DEFAULTS = { + null, + }; + // // Data // @@ -525,6 +535,42 @@ } // setProperty(String,Object) + /** + * Returns the default state for a feature, or null if this + * component does not want to report a default value for this + * feature. + * + * @param featureId The feature identifier. + * + * @since Xerces 2.2.0 + */ + public Boolean getFeatureDefault(String featureId) { + for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { + if (RECOGNIZED_FEATURES[i].equals(featureId)) { + return FEATURE_DEFAULTS[i]; + } + } + return null; + } // getFeatureDefault(String):Boolean + + /** + * Returns the default state for a property, or null if this + * component does not want to report a default value for this + * property. + * + * @param propertyId The property identifier. + * + * @since Xerces 2.2.0 + */ + public Object getPropertyDefault(String propertyId) { + for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { + if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { + return PROPERTY_DEFAULTS[i]; + } + } + return null; + } // getPropertyDefault(String):Object + /** * Get the internal XMLErrrorHandler. */ 1.23 +48 -1 xml-xerces/java/src/org/apache/xerces/impl/XMLNamespaceBinder.java Index: XMLNamespaceBinder.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLNamespaceBinder.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- XMLNamespaceBinder.java 16 Sep 2002 21:36:40 -0000 1.22 +++ XMLNamespaceBinder.java 24 Sep 2002 09:39:44 -0000 1.23 @@ -133,12 +133,23 @@ NAMESPACES, }; + /** Feature defaults. */ + private static final Boolean[] FEATURE_DEFAULTS = { + null, + }; + /** Recognized properties. */ private static final String[] RECOGNIZED_PROPERTIES = { SYMBOL_TABLE, ERROR_REPORTER, }; + /** Property defaults. */ + private static final Object[] PROPERTY_DEFAULTS = { + null, + null, + }; + // // Data // @@ -349,6 +360,42 @@ } } // setProperty(String,Object) + + /** + * Returns the default state for a feature, or null if this + * component does not want to report a default value for this + * feature. + * + * @param featureId The feature identifier. + * + * @since Xerces 2.2.0 + */ + public Boolean getFeatureDefault(String featureId) { + for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { + if (RECOGNIZED_FEATURES[i].equals(featureId)) { + return FEATURE_DEFAULTS[i]; + } + } + return null; + } // getFeatureDefault(String):Boolean + + /** + * Returns the default state for a property, or null if this + * component does not want to report a default value for this + * property. + * + * @param propertyId The property identifier. + * + * @since Xerces 2.2.0 + */ + public Object getPropertyDefault(String propertyId) { + for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { + if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { + return PROPERTY_DEFAULTS[i]; + } + } + return null; + } // getPropertyDefault(String):Object // // XMLDocumentSource methods 1.5 +52 -1 xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java Index: XMLDTDProcessor.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XMLDTDProcessor.java 13 Aug 2002 22:57:09 -0000 1.4 +++ XMLDTDProcessor.java 24 Sep 2002 09:39:44 -0000 1.5 @@ -161,6 +161,13 @@ NOTIFY_CHAR_REFS, }; + /** Feature defaults. */ + private static final Boolean[] FEATURE_DEFAULTS = { + null, + Boolean.FALSE, + null, + }; + /** Recognized properties. */ private static final String[] RECOGNIZED_PROPERTIES = { SYMBOL_TABLE, @@ -169,6 +176,14 @@ DTD_VALIDATOR, }; + /** Property defaults. */ + private static final Object[] PROPERTY_DEFAULTS = { + null, + null, + null, + null, + }; + // debugging // @@ -413,6 +428,42 @@ public void setProperty(String propertyId, Object value) throws XMLConfigurationException { } // setProperty(String,Object) + + /** + * Returns the default state for a feature, or null if this + * component does not want to report a default value for this + * feature. + * + * @param featureId The feature identifier. + * + * @since Xerces 2.2.0 + */ + public Boolean getFeatureDefault(String featureId) { + for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { + if (RECOGNIZED_FEATURES[i].equals(featureId)) { + return FEATURE_DEFAULTS[i]; + } + } + return null; + } // getFeatureDefault(String):Boolean + + /** + * Returns the default state for a property, or null if this + * component does not want to report a default value for this + * property. + * + * @param propertyId The property identifier. + * + * @since Xerces 2.2.0 + */ + public Object getPropertyDefault(String propertyId) { + for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { + if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { + return PROPERTY_DEFAULTS[i]; + } + } + return null; + } // getPropertyDefault(String):Object // // XMLDTDSource methods 1.35 +53 -1 xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java Index: XMLDTDValidator.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- XMLDTDValidator.java 19 Sep 2002 17:49:46 -0000 1.34 +++ XMLDTDValidator.java 24 Sep 2002 09:39:44 -0000 1.35 @@ -190,6 +190,13 @@ DYNAMIC_VALIDATION }; + /** Feature defaults. */ + private static final Boolean[] FEATURE_DEFAULTS = { + null, + null, + Boolean.FALSE, + }; + /** Recognized properties. */ private static final String[] RECOGNIZED_PROPERTIES = { SYMBOL_TABLE, @@ -199,6 +206,15 @@ VALIDATION_MANAGER }; + /** Property defaults. */ + private static final Object[] PROPERTY_DEFAULTS = { + null, + null, + null, + null, + null, + }; + // debugging /** Compile to true to debug attributes. */ @@ -556,6 +572,42 @@ public void setProperty(String propertyId, Object value) throws XMLConfigurationException { } // setProperty(String,Object) + + /** + * Returns the default state for a feature, or null if this + * component does not want to report a default value for this + * feature. + * + * @param featureId The feature identifier. + * + * @since Xerces 2.2.0 + */ + public Boolean getFeatureDefault(String featureId) { + for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { + if (RECOGNIZED_FEATURES[i].equals(featureId)) { + return FEATURE_DEFAULTS[i]; + } + } + return null; + } // getFeatureDefault(String):Boolean + + /** + * Returns the default state for a property, or null if this + * component does not want to report a default value for this + * property. + * + * @param propertyId The property identifier. + * + * @since Xerces 2.2.0 + */ + public Object getPropertyDefault(String propertyId) { + for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { + if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { + return PROPERTY_DEFAULTS[i]; + } + } + return null; + } // getPropertyDefault(String):Object // // XMLDocumentSource methods 1.105 +57 -1 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.104 retrieving revision 1.105 diff -u -r1.104 -r1.105 --- XMLSchemaValidator.java 23 Sep 2002 18:31:30 -0000 1.104 +++ XMLSchemaValidator.java 24 Sep 2002 09:39:45 -0000 1.105 @@ -232,6 +232,14 @@ SCHEMA_FULL_CHECKING, }; + /** Feature defaults. */ + private static final Boolean[] FEATURE_DEFAULTS = { + null, + Boolean.FALSE, + Boolean.FALSE, + Boolean.FALSE, + }; + /** Recognized properties. */ private static final String[] RECOGNIZED_PROPERTIES = { SYMBOL_TABLE, @@ -244,6 +252,18 @@ NAMESPACE_CONTEXT_PROPERTY }; + /** Property defaults. */ + private static final Object[] PROPERTY_DEFAULTS = { + null, + null, + null, + null, + null, + null, + null, + null, + }; + // this is the number of valuestores of each kind // we expect an element to have. It's almost // never > 1; so leave it at that. @@ -474,6 +494,42 @@ public void setProperty(String propertyId, Object value) throws XMLConfigurationException { } // setProperty(String,Object) + + /** + * Returns the default state for a feature, or null if this + * component does not want to report a default value for this + * feature. + * + * @param featureId The feature identifier. + * + * @since Xerces 2.2.0 + */ + public Boolean getFeatureDefault(String featureId) { + for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { + if (RECOGNIZED_FEATURES[i].equals(featureId)) { + return FEATURE_DEFAULTS[i]; + } + } + return null; + } // getFeatureDefault(String):Boolean + + /** + * Returns the default state for a property, or null if this + * component does not want to report a default value for this + * property. + * + * @param propertyId The property identifier. + * + * @since Xerces 2.2.0 + */ + public Object getPropertyDefault(String propertyId) { + for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { + if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { + return PROPERTY_DEFAULTS[i]; + } + } + return null; + } // getPropertyDefault(String):Object // // XMLDocumentSource methods 1.12 +22 -2 xml-xerces/java/src/org/apache/xerces/parsers/BasicParserConfiguration.java Index: BasicParserConfiguration.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/BasicParserConfiguration.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- BasicParserConfiguration.java 16 Sep 2002 21:36:41 -0000 1.11 +++ BasicParserConfiguration.java 24 Sep 2002 09:39:45 -0000 1.12 @@ -310,10 +310,30 @@ // register component's recognized features String[] recognizedFeatures = component.getRecognizedFeatures(); addRecognizedFeatures(recognizedFeatures); - + // register component's recognized properties String[] recognizedProperties = component.getRecognizedProperties(); addRecognizedProperties(recognizedProperties); + + // set default values + if (recognizedFeatures != null) { + for (int i = 0; i < recognizedFeatures.length; i++) { + String featureId = recognizedFeatures[i]; + Boolean state = component.getFeatureDefault(featureId); + if (state != null) { + setFeature(featureId, state.booleanValue()); + } + } + } + if (recognizedProperties != null) { + for (int i = 0; i < recognizedProperties.length; i++) { + String propertyId = recognizedProperties[i]; + Object value = component.getPropertyDefault(propertyId); + if (value != null) { + setProperty(propertyId, value); + } + } + } } // addComponent(XMLComponent) 1.6 +16 -12 xml-xerces/java/src/org/apache/xerces/parsers/DTDConfiguration.java Index: DTDConfiguration.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DTDConfiguration.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- DTDConfiguration.java 16 Aug 2002 18:08:38 -0000 1.5 +++ DTDConfiguration.java 24 Sep 2002 09:39:45 -0000 1.6 @@ -318,22 +318,26 @@ // add default recognized features final String[] recognizedFeatures = { - WARN_ON_DUPLICATE_ATTDEF, WARN_ON_UNDECLARED_ELEMDEF, - ALLOW_JAVA_ENCODINGS, CONTINUE_AFTER_FATAL_ERROR, - LOAD_EXTERNAL_DTD, NOTIFY_BUILTIN_REFS, - NOTIFY_CHAR_REFS, WARN_ON_DUPLICATE_ENTITYDEF + //WARN_ON_DUPLICATE_ATTDEF, // from XMLDTDScannerImpl + //WARN_ON_UNDECLARED_ELEMDEF, // from XMLDTDScannerImpl + //ALLOW_JAVA_ENCODINGS, // from XMLEntityManager + CONTINUE_AFTER_FATAL_ERROR, + //LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl + //NOTIFY_BUILTIN_REFS, // from XMLDocumentFragmentScannerImpl + //NOTIFY_CHAR_REFS, // from XMLDocumentFragmentScannerImpl + //WARN_ON_DUPLICATE_ENTITYDEF, // from XMLEntityManager }; addRecognizedFeatures(recognizedFeatures); // set state for default features - setFeature(WARN_ON_DUPLICATE_ATTDEF, false); - setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false); - setFeature(WARN_ON_UNDECLARED_ELEMDEF, false); - setFeature(ALLOW_JAVA_ENCODINGS, false); + //setFeature(WARN_ON_DUPLICATE_ATTDEF, false); // from XMLDTDScannerImpl + //setFeature(WARN_ON_UNDECLARED_ELEMDEF, false); // from XMLDTDScannerImpl + //setFeature(ALLOW_JAVA_ENCODINGS, false); // from XMLEntityManager setFeature(CONTINUE_AFTER_FATAL_ERROR, false); - setFeature(LOAD_EXTERNAL_DTD, true); - setFeature(NOTIFY_BUILTIN_REFS, false); - setFeature(NOTIFY_CHAR_REFS, false); + //setFeature(LOAD_EXTERNAL_DTD, true); // from XMLDTDScannerImpl + //setFeature(NOTIFY_BUILTIN_REFS, false); // from XMLDocumentFragmentScannerImpl + //setFeature(NOTIFY_CHAR_REFS, false); // from XMLDocumentFragmentScannerImpl + //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false); // from XMLEntityManager // add default recognized properties final String[] recognizedProperties = { 1.5 +16 -12 xml-xerces/java/src/org/apache/xerces/parsers/NonValidatingConfiguration.java Index: NonValidatingConfiguration.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/NonValidatingConfiguration.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NonValidatingConfiguration.java 16 Sep 2002 17:54:39 -0000 1.4 +++ NonValidatingConfiguration.java 24 Sep 2002 09:39:45 -0000 1.5 @@ -304,22 +304,26 @@ // add default recognized features final String[] recognizedFeatures = { - WARN_ON_DUPLICATE_ATTDEF, WARN_ON_UNDECLARED_ELEMDEF, - ALLOW_JAVA_ENCODINGS, CONTINUE_AFTER_FATAL_ERROR, - LOAD_EXTERNAL_DTD, NOTIFY_BUILTIN_REFS, - NOTIFY_CHAR_REFS, WARN_ON_DUPLICATE_ENTITYDEF + //WARN_ON_DUPLICATE_ATTDEF, // from XMLDTDScannerImpl + //WARN_ON_UNDECLARED_ELEMDEF, // from XMLDTDScannerImpl + //ALLOW_JAVA_ENCODINGS, // from XMLEntityManager + CONTINUE_AFTER_FATAL_ERROR, + //LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl + //NOTIFY_BUILTIN_REFS, // from XMLDocumentFragmentScannerImpl + //NOTIFY_CHAR_REFS, // from XMLDocumentFragmentScannerImpl + //WARN_ON_DUPLICATE_ENTITYDEF // from XMLEntityManager }; addRecognizedFeatures(recognizedFeatures); // set state for default features - setFeature(WARN_ON_DUPLICATE_ATTDEF, false); - setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false); - setFeature(WARN_ON_UNDECLARED_ELEMDEF, false); - setFeature(ALLOW_JAVA_ENCODINGS, false); + //setFeature(WARN_ON_DUPLICATE_ATTDEF, false); // from XMLDTDScannerImpl + //setFeature(WARN_ON_UNDECLARED_ELEMDEF, false); // from XMLDTDScannerImpl + //setFeature(ALLOW_JAVA_ENCODINGS, false); // from XMLEntityManager setFeature(CONTINUE_AFTER_FATAL_ERROR, false); - setFeature(LOAD_EXTERNAL_DTD, true); - setFeature(NOTIFY_BUILTIN_REFS, false); - setFeature(NOTIFY_CHAR_REFS, false); + //setFeature(LOAD_EXTERNAL_DTD, true); // from XMLDTDScannerImpl + //setFeature(NOTIFY_BUILTIN_REFS, false); // from XMLDocumentFragmentScannerImpl + //setFeature(NOTIFY_CHAR_REFS, false); // from XMLDocumentFragmentScannerImpl + //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false); // from XMLEntityManager // add default recognized properties final String[] recognizedProperties = { 1.5 +23 -1 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLComponent.java Index: XMLComponent.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xni/parser/XMLComponent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XMLComponent.java 29 Jan 2002 01:15:19 -0000 1.4 +++ XMLComponent.java 24 Sep 2002 09:39:45 -0000 1.5 @@ -139,4 +139,26 @@ public void setProperty(String propertyId, Object value) throws XMLConfigurationException; + /** + * Returns the default state for a feature, or null if this + * component does not want to report a default value for this + * feature. + * + * @param featureId The feature identifier. + * + * @since Xerces 2.2.0 + */ + public Boolean getFeatureDefault(String featureId); + + /** + * Returns the default state for a property, or null if this + * component does not want to report a default value for this + * property. + * + * @param propertyId The property identifier. + * + * @since Xerces 2.2.0 + */ + public Object getPropertyDefault(String propertyId); + } // interface XMLComponent
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]