You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@apache.org on 2001/02/27 00:32:22 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/parsers BasicParserConfiguration.java ParserConfiguration.java StandardParserConfiguration.java AbstractDOMParser.java AbstractSAXParser.java AbstractXMLDocumentParser.java DOMParser.java SAXParser.java XMLDocumentParser.java XMLGrammarParser.java XMLParser.java

lehors      01/02/26 15:32:22

  Modified:    java/src/org/apache/xerces/parsers Tag: xerces_j_2
                        AbstractDOMParser.java AbstractSAXParser.java
                        AbstractXMLDocumentParser.java DOMParser.java
                        SAXParser.java XMLDocumentParser.java
                        XMLGrammarParser.java XMLParser.java
  Added:       java/src/org/apache/xerces/parsers Tag: xerces_j_2
                        BasicParserConfiguration.java
                        ParserConfiguration.java
                        StandardParserConfiguration.java
  Log:
  prototype of a parser using a ParserConfiguration thingy
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +5 -13     xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractDOMParser.java
  
  Index: AbstractDOMParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractDOMParser.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- AbstractDOMParser.java	2001/02/16 08:05:48	1.1.2.4
  +++ AbstractDOMParser.java	2001/02/26 23:32:19	1.1.2.5
  @@ -61,8 +61,6 @@
   import org.apache.xerces.dom.EntityReferenceImpl;
   import org.apache.xerces.dom.TextImpl;
   
  -import org.apache.xerces.util.SymbolTable;
  -
   import org.apache.xerces.xni.QName;
   import org.apache.xerces.xni.XMLAttributes;
   import org.apache.xerces.xni.XMLString;
  @@ -91,7 +89,7 @@
    * @author Andy Clark, IBM
    *
    * 
  - * @version $Id: AbstractDOMParser.java,v 1.1.2.4 2001/02/16 08:05:48 andyc Exp $ */
  + * @version $Id: AbstractDOMParser.java,v 1.1.2.5 2001/02/26 23:32:19 lehors Exp $ */
   public abstract class AbstractDOMParser
       extends AbstractXMLDocumentParser {
   
  @@ -128,15 +126,9 @@
       //
   
       /** Default constructor. */
  -    protected AbstractDOMParser() {
  -    } // <init>()
  -
  -    /**
  -     * Constructs a DOM parser using the specified symbol table.
  -     */
  -    protected AbstractDOMParser(SymbolTable symbolTable) {
  -        super(symbolTable);
  -    } // <init>(SymbolTable)
  +    protected AbstractDOMParser(ParserConfiguration config) {
  +        super(config);
  +    } // <init>(ParserConfiguration)
   
       //
       // Public methods
  @@ -156,7 +148,7 @@
        *
        * @throws SAXException Thrown on initialization error.
        */
  -    protected void reset() throws SAXException {
  +    public void reset() throws SAXException {
           super.reset();
   
           // reset dom information
  
  
  
  1.1.2.5   +33 -17    xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractSAXParser.java
  
  Index: AbstractSAXParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractSAXParser.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- AbstractSAXParser.java	2001/02/16 08:05:48	1.1.2.4
  +++ AbstractSAXParser.java	2001/02/26 23:32:19	1.1.2.5
  @@ -57,7 +57,7 @@
   
   package org.apache.xerces.parsers;
   
  -import java.io.IOException;
  +import java.util.Hashtable;
   
   import org.apache.xerces.impl.Constants;
   import org.apache.xerces.util.SymbolTable;
  @@ -70,7 +70,6 @@
   import org.xml.sax.DTDHandler;
   import org.xml.sax.DocumentHandler;
   import org.xml.sax.EntityResolver;
  -import org.xml.sax.ErrorHandler;
   import org.xml.sax.InputSource;
   import org.xml.sax.Parser;
   import org.xml.sax.SAXException;
  @@ -88,7 +87,7 @@
    * @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
    * @author Andy Clark, IBM
    *
  - * @version $Id: AbstractSAXParser.java,v 1.1.2.4 2001/02/16 08:05:48 andyc Exp $ */
  + * @version $Id: AbstractSAXParser.java,v 1.1.2.5 2001/02/26 23:32:19 lehors Exp $ */
   public abstract class AbstractSAXParser
       extends AbstractXMLDocumentParser
       implements Parser, XMLReader // SAX1, SAX2
  @@ -120,21 +119,24 @@
       /** Symbol: empty string (""). */
       private String fEmptySymbol;
   
  +    // state
  +
  +    /** 
  +     * True if a parse is in progress. This state is needed because
  +     * some features/properties cannot be set while parsing (e.g.
  +     * validation and namespaces).
  +     */
  +    protected boolean fParseInProgress = false;
  +
       //
       // Constructors
       //
   
       /** Default constructor. */
  -    protected AbstractSAXParser() {
  -    } // <init>()
  +    protected AbstractSAXParser(ParserConfiguration config) {
  +        super(config);
  +    } // <init>(ParserConfiguration)
   
  -    /**
  -     * Constructs a SAX parser using the specified symbol table.
  -     */
  -    protected AbstractSAXParser(SymbolTable symbolTable) {
  -        super(symbolTable);
  -    } // <init>(SymbolTable)
  -
       //
       // XMLDocumentHandler methods
       //
  @@ -355,6 +357,12 @@
        * pseudo-name of "[dtd]; parameter entity names start with '%'; and 
        * general entity names are just the entity name.
        * <p>
  +     * <strong>Note:</strong> Since the document is an entity, the handler
  +     * will be notified of the start of the document entity by calling the
  +     * startEntity method with the entity name "[xml]" <em>before</em> calling
  +     * the startDocument method. When exposing entity boundaries through the
  +     * SAX API, the document entity is never reported, however.
  +     * <p>
        * <strong>Note:</strong> Since the DTD is an entity, the handler
        * will be notified of the start of the DTD entity by calling the
        * startEntity method with the entity name "[dtd]" <em>before</em> calling
  @@ -387,6 +395,12 @@
        * of "[dtd]; parameter entity names start with '%'; and general entity
        * names are just the entity name.
        * <p>
  +     * <strong>Note:</strong> Since the document is an entity, the handler
  +     * will be notified of the end of the document entity by calling the
  +     * endEntity method with the entity name "[xml]" <em>after</em> calling
  +     * the endDocument method. When exposing entity boundaries through the
  +     * SAX API, the document entity is never reported, however.
  +     * <p>
        * <strong>Note:</strong> Since the DTD is an entity, the handler
        * will be notified of the end of the DTD entity by calling the
        * endEntity method with the entity name "[dtd]" <em>after</em> calling
  @@ -682,7 +696,7 @@
        */
       public void setDocumentHandler(DocumentHandler documentHandler) {
           fDocumentHandler = documentHandler;
  -        fDocumentHandler.setDocumentLocator(fLocator);
  +        fDocumentHandler.setDocumentLocator(fConfiguration.getLocator());
       } // setDocumentHandler(DocumentHandler)
   
       //
  @@ -758,6 +772,7 @@
           // SAX2 Features
           //
   
  +        Hashtable features = fConfiguration.getFeatureTable();
           if (featureId.startsWith(Constants.SAX_FEATURE_PREFIX)) {
               String feature = featureId.substring(Constants.SAX_FEATURE_PREFIX.length());
   
  @@ -768,7 +783,7 @@
               //   and xmlns* attributes must not be reported.
               //
               if (feature.equals(Constants.NAMESPACE_PREFIXES_FEATURE)) {
  -                fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE);
  +                features.put(featureId, state ? Boolean.TRUE : Boolean.FALSE);
                   return;
               }
               // http://xml.org/sax/features/string-interning
  @@ -832,6 +847,7 @@
           // SAX2 Features
           //
   
  +        Hashtable features = fConfiguration.getFeatureTable();
           if (featureId.startsWith(Constants.SAX_FEATURE_PREFIX)) {
               String feature =
                   featureId.substring(Constants.SAX_FEATURE_PREFIX.length());
  @@ -843,7 +859,7 @@
               //   and xmlns* attributes must not be reported.
               //
               if (feature.equals(Constants.NAMESPACE_PREFIXES_FEATURE)) {
  -                Boolean state = (Boolean) fFeatures.get(featureId);
  +                Boolean state = (Boolean) features.get(featureId);
                   return state.booleanValue();
               }
               // http://xml.org/sax/features/string-interning
  @@ -1160,11 +1176,11 @@
        *
        * @throws SAXException Thrown if an error occurs during initialization.
        */
  -    protected void reset() throws SAXException {
  +    public void reset() throws SAXException {
           super.reset();
   
           // save needed symbols
  -        fEmptySymbol = fSymbolTable.addSymbol("");
  +        fEmptySymbol = fConfiguration.getSymbolTable().addSymbol("");
   
       } // reset()
   
  
  
  
  1.1.2.3   +7 -34     xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractXMLDocumentParser.java
  
  Index: AbstractXMLDocumentParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractXMLDocumentParser.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- AbstractXMLDocumentParser.java	2001/02/16 08:05:48	1.1.2.2
  +++ AbstractXMLDocumentParser.java	2001/02/26 23:32:19	1.1.2.3
  @@ -58,16 +58,6 @@
   
   package org.apache.xerces.parsers;
   
  -import java.io.IOException;
  -
  -import org.apache.xerces.impl.Constants;
  -import org.apache.xerces.impl.XMLDocumentScanner;
  -import org.apache.xerces.impl.XMLDTDScanner;
  -import org.apache.xerces.impl.XMLEntityManager;
  -import org.apache.xerces.impl.XMLInputSource;
  -
  -import org.apache.xerces.util.SymbolTable;
  -
   import org.apache.xerces.xni.QName;
   import org.apache.xerces.xni.XMLAttributes;
   import org.apache.xerces.xni.XMLDocumentHandler;
  @@ -75,10 +65,7 @@
   import org.apache.xerces.xni.XMLDTDContentModelHandler;
   import org.apache.xerces.xni.XMLString;
   
  -import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  -import org.xml.sax.SAXNotRecognizedException;
  -import org.xml.sax.SAXNotSupportedException;
   
   /**
    * This is the base class for all XML document parsers. XMLDocumentParser
  @@ -91,7 +78,7 @@
    * @author Arnaud  Le Hors, IBM
    * @author Andy Clark, IBM
    *
  - * @version $Id: AbstractXMLDocumentParser.java,v 1.1.2.2 2001/02/16 08:05:48 andyc Exp $
  + * @version $Id: AbstractXMLDocumentParser.java,v 1.1.2.3 2001/02/26 23:32:19 lehors Exp $
    */
   public abstract class AbstractXMLDocumentParser
       extends XMLParser
  @@ -103,15 +90,6 @@
   
       // state
   
  -    /** 
  -     * True if a parse is in progress. This state is needed because
  -     * some features/properties cannot be set while parsing (e.g.
  -     * validation and namespaces).
  -     */
  -    protected boolean fParseInProgress = false;
  -
  -    // state
  -
       /** True if inside DTD. */
       protected boolean fInDTD;
   
  @@ -122,18 +100,13 @@
       /**
        * Constructs a document parser using the default symbol table
        * and grammar pool.
  -     */
  -    protected AbstractXMLDocumentParser() {
  -    } // <init>()
  -
  -    /**
  -     * Constructs a document parser using the specified symbol table
  -     * and a default grammar pool.
  -     *
        */
  -    protected AbstractXMLDocumentParser(SymbolTable symbolTable) {
  -        super(symbolTable);
  -    } // <init>(SymbolTable)
  +    protected AbstractXMLDocumentParser(ParserConfiguration config) {
  +        super(config);
  +        config.setDocumentHandler(this);
  +        config.setDTDHandler(this);
  +        config.setDTDContentModelHandler(this);
  +    } // <init>(ParserConfiguration)
   
       //
       // XMLDocumentHandler methods
  
  
  
  1.19.2.15 +14 -349   xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java
  
  Index: DOMParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java,v
  retrieving revision 1.19.2.14
  retrieving revision 1.19.2.15
  diff -u -r1.19.2.14 -r1.19.2.15
  --- DOMParser.java	2001/02/16 08:05:48	1.19.2.14
  +++ DOMParser.java	2001/02/26 23:32:19	1.19.2.15
  @@ -57,25 +57,9 @@
   
   package org.apache.xerces.parsers;
   
  -import java.io.IOException;
  -
  -import org.apache.xerces.impl.Constants;
  -import org.apache.xerces.impl.XMLDocumentScanner;
  -import org.apache.xerces.impl.XMLDTDScanner;
  -import org.apache.xerces.impl.XMLEntityManager;
  -import org.apache.xerces.impl.XMLInputSource;
  -import org.apache.xerces.impl.XMLValidator;
  -import org.apache.xerces.impl.validation.DatatypeValidatorFactory;
   import org.apache.xerces.impl.validation.GrammarPool;
  -import org.apache.xerces.impl.validation.datatypes.DatatypeValidatorFactoryImpl;
  -
   import org.apache.xerces.util.SymbolTable;
   
  -import org.xml.sax.InputSource;
  -import org.xml.sax.SAXException;
  -import org.xml.sax.SAXNotRecognizedException;
  -import org.xml.sax.SAXNotSupportedException;
  -
   /**
    * This is the main Xerces DOM parser class. It uses the abstract DOM parser
    * with a document scanner, a dtd scanner, and a validator, as well as a
  @@ -85,360 +69,41 @@
    * @author Arnaud  Le Hors, IBM
    * @author Andy Clark, IBM
    *
  - * @version $Id: DOMParser.java,v 1.19.2.14 2001/02/16 08:05:48 andyc Exp $ */
  + * @version $Id: DOMParser.java,v 1.19.2.15 2001/02/26 23:32:19 lehors Exp $ */
   public class DOMParser
       extends AbstractDOMParser {
   
       //
  -    // Constants
  -    //
  -
  -    // debugging
  -
  -    /** Set to true and recompile to print exception stack trace. */
  -    private static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
  -
  -    //
  -    // Data
  -    //
  -
  -    // components (non-configurable)
  -
  -    /** Grammar pool. */
  -    protected GrammarPool fGrammarPool;
  -
  -    /** Datatype validator factory. */
  -    protected DatatypeValidatorFactory fDatatypeValidatorFactory;
  -
  -    // components (configurable)
  -
  -    /** Document scanner. */
  -    protected XMLDocumentScanner fScanner;
  -
  -    /** DTD scanner. */
  -    protected XMLDTDScanner fDTDScanner;
  -
  -    /** Validator. */
  -    protected XMLValidator fValidator;
  -
  -    //
       // Constructors
       //
   
       /**
  -     * Constructs a DOM parser using the default symbol table and grammar pool
  -     * or the ones specified by the application (through the properties).
  +     * Constructs a DOM parser using the default basic parser configuration.
        */
       public DOMParser() {
  +        super(new StandardParserConfiguration());
       } // <init>
   
       /**
  +     * Constructs a DOM parser using the specified parser configuration.
  +     */
  +    public DOMParser(ParserConfiguration config) {
  +        super(config);
  +    } // <init>(ParserConfiguration)
  +
  +    /**
        * Constructs a DOM parser using the specified symbol table.
        */
       public DOMParser(SymbolTable symbolTable) {
  -        super(symbolTable);
  +        super(new StandardParserConfiguration(symbolTable));
       } // <init>(SymbolTable)
   
       /**
  -     * Constructs a DOM parser using the specified symbol table and grammar
  -     * pool.
  +     * Constructs a DOM parser using the specified symbol table and
  +     * grammar pool.
        */
       public DOMParser(SymbolTable symbolTable, GrammarPool grammarPool) {
  -        super(symbolTable);
  -
  -        final String GRAMMAR_POOL = Constants.XERCES_PROPERTY_PREFIX + Constants.GRAMMAR_POOL_PROPERTY;
  -        fGrammarPool = new GrammarPool();
  -        fProperties.put(GRAMMAR_POOL, fGrammarPool);
  +        super(new StandardParserConfiguration(symbolTable, grammarPool));
       }
  -
  -    /**
  -     * Initialize the parser with all the components specified via the
  -     * properties plus any missing ones. This method MUST be called before
  -     * parsing. It is not called from the constructor though, so that the
  -     * application can pass in any components it wants by presetting the
  -     * relevant property.
  -     */
  -    public void initialize() {
  -        super.initialize();
  -
  -        // set default features
  -        final String NAMESPACES = Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
  -        fFeatures.put(NAMESPACES, Boolean.TRUE);
  -        final String VALIDATION = Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
  -        fFeatures.put(VALIDATION, Boolean.FALSE);
  -        final String EXTERNAL_GENERAL_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE;
  -        fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
  -        final String EXTERNAL_PARAMETER_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE;
  -        fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE);
  -
  -        // create and register missing components
  -        final String GRAMMAR_POOL = Constants.XERCES_PROPERTY_PREFIX + Constants.GRAMMAR_POOL_PROPERTY;
  -        fGrammarPool = (GrammarPool) fProperties.get(GRAMMAR_POOL);
  -        if (fGrammarPool == null) {
  -            fGrammarPool = new GrammarPool();
  -            fProperties.put(GRAMMAR_POOL, fGrammarPool);
  -        }
  -
  -        final String DOCUMENT_SCANNER = Constants.XERCES_PROPERTY_PREFIX + Constants.DOCUMENT_SCANNER_PROPERTY;
  -        fScanner = (XMLDocumentScanner) fProperties.get(DOCUMENT_SCANNER);
  -        if (fScanner == null) {
  -            fScanner = createDocumentScanner();
  -            fProperties.put(DOCUMENT_SCANNER, fScanner);
  -        }
  -        fComponents.addElement(fScanner);
  -
  -        final String DTD_SCANNER = Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;
  -        fDTDScanner = (XMLDTDScanner) fProperties.get(DTD_SCANNER);
  -        if (fDTDScanner == null) {
  -            fDTDScanner = createDTDScanner();
  -            fProperties.put(DTD_SCANNER, fDTDScanner);
  -        }
  -        fComponents.addElement(fDTDScanner);
  -
  -        final String VALIDATOR = Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATOR_PROPERTY;
  -        fValidator = (XMLValidator) fProperties.get(VALIDATOR);
  -        if (fValidator == null) {
  -            fValidator = createValidator();
  -            fProperties.put(VALIDATOR, fValidator);
  -        }
  -        fComponents.addElement(fValidator);
  -        
  -        final String DATATYPE_VALIDATOR_FACTORY = Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY;
  -        fDatatypeValidatorFactory = (DatatypeValidatorFactory)
  -            fProperties.get(DATATYPE_VALIDATOR_FACTORY);
  -        if (fDatatypeValidatorFactory == null) {
  -            fDatatypeValidatorFactory = createDatatypeValidatorFactory();
  -            fProperties.put(DATATYPE_VALIDATOR_FACTORY,
  -                            fDatatypeValidatorFactory);
  -        }
  -
  -    } // initialize()
  -
  -    //
  -    // XMLParser methods
  -    //
  -
  -    /** 
  -     * Reset all components before parsing. 
  -     *
  -     * @throws SAXException Thrown if an error occurs during initialization.
  -     */
  -    protected void reset() throws SAXException {
  -
  -        // setup document pipeline
  -        fScanner.setDocumentHandler(fValidator);
  -        fValidator.setDocumentHandler(this);
  -
  -        // setup dtd pipeline
  -        fDTDScanner.setDTDHandler(fValidator);
  -        fValidator.setDTDHandler(this);
  -
  -        // setup dtd content model pipeline
  -        fDTDScanner.setDTDContentModelHandler(fValidator);
  -        fValidator.setDTDContentModelHandler(this);
  -
  -        // the following will reset every component
  -        super.reset();
  -
  -    } // reset()
  -
  -    //
  -    // XMLReader methods
  -    //
  -
  -    /**
  -     * Parses the specified input source.
  -     *
  -     * @param source The input source.
  -     *
  -     * @exception org.xml.sax.SAXException Throws exception on SAX error.
  -     * @exception java.io.IOException Throws exception on i/o error.
  -     */
  -    public void parse(InputSource source)
  -        throws SAXException, IOException {
  -
  -        if (fParseInProgress) {
  -            // REVISIT - need to add new error message
  -            throw new SAXException("FWK005 parse may not be called while parsing.");
  -        }
  -        else if (fNeedInitialize) {
  -            initialize();
  -        }
  -
  -        try {
  -            reset();
  -            fEntityManager.setEntityHandler(fScanner);
  -            fEntityManager.startDocumentEntity(new XMLInputSource(source));
  -            fScanner.scanDocument(true);
  -            fParseInProgress = false;
  -        } 
  -        catch (SAXException ex) {
  -            fParseInProgress = false;
  -            if (PRINT_EXCEPTION_STACK_TRACE)
  -                ex.printStackTrace();
  -            throw ex;
  -        } 
  -        catch (IOException ex) {
  -            fParseInProgress = false;
  -            if (PRINT_EXCEPTION_STACK_TRACE)
  -                ex.printStackTrace();
  -            throw ex;
  -        } 
  -        catch (Exception ex) {
  -            fParseInProgress = false;
  -            if (PRINT_EXCEPTION_STACK_TRACE)
  -                ex.printStackTrace();
  -            throw new org.xml.sax.SAXException(ex);
  -        }
  -
  -    } // parse(InputSource)
  -
  -    //
  -    // XMLParser methods
  -    //
  -
  -    /**
  -     * Check a feature. If feature is know and supported, this method simply
  -     * returns. Otherwise, the appropriate exception is thrown.
  -     *
  -     * @param featureId The unique identifier (URI) of the feature.
  -     *
  -     * @exception org.xml.sax.SAXNotRecognizedException If the
  -     *            requested feature is not known.
  -     * @exception org.xml.sax.SAXNotSupportedException If the
  -     *            requested feature is known, but the requested
  -     *            state is not supported.
  -     * @exception org.xml.sax.SAXException If there is any other
  -     *            problem fulfilling the request.
  -     */
  -    protected void checkFeature(String featureId)
  -        throws SAXNotRecognizedException, SAXNotSupportedException {
  -
  -        //
  -        // Xerces Features
  -        //
  -
  -        if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
  -            String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
  -            //
  -            // http://apache.org/xml/features/validation/schema
  -            //   Lets the user turn Schema validation support on/off.
  -            //
  -            if (feature.equals(Constants.SCHEMA_VALIDATION_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/dynamic
  -            //   Allows the parser to validate a document only when it
  -            //   contains a grammar. Validation is turned on/off based
  -            //   on each document instance, automatically.
  -            //
  -            if (feature.equals(Constants.DYNAMIC_VALIDATION_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/default-attribute-values
  -            //
  -            if (feature.equals(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) {
  -                // REVISIT
  -                throw new SAXNotSupportedException(featureId);
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/default-attribute-values
  -            //
  -            if (feature.equals(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) {
  -                // REVISIT
  -                throw new SAXNotSupportedException(featureId);
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar
  -            //
  -            if (feature.equals(Constants.LOAD_DTD_GRAMMAR_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/nonvalidating/load-external-dtd
  -            //
  -            if (feature.equals(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
  -                return;
  -            }
  -
  -            //
  -            // http://apache.org/xml/features/validation/default-attribute-values
  -            //
  -            if (feature.equals(Constants.VALIDATE_DATATYPES_FEATURE)) {
  -                throw new SAXNotSupportedException(featureId);
  -            }
  -        }
  -
  -        //
  -        // Not recognized
  -        //
  -
  -        super.checkFeature(featureId);
  -
  -    } // checkFeature(String)
  -
  -    /**
  -     * Check a property. If the property is know and supported, this method
  -     * simply returns. Otherwise, the appropriate exception is thrown.
  -     *
  -     * @param propertyId The unique identifier (URI) of the property
  -     *                   being set.
  -     * @exception org.xml.sax.SAXNotRecognizedException If the
  -     *            requested property is not known.
  -     * @exception org.xml.sax.SAXNotSupportedException If the
  -     *            requested property is known, but the requested
  -     *            value is not supported.
  -     * @exception org.xml.sax.SAXException If there is any other
  -     *            problem fulfilling the request.
  -     */
  -    protected void checkProperty(String propertyId)
  -        throws SAXNotRecognizedException, SAXNotSupportedException {
  -
  -        //
  -        // Xerces Properties
  -        //
  -
  -        if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
  -            String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
  -            if (property.equals(Constants.DTD_SCANNER_PROPERTY)) {
  -                return;
  -            }
  -        }
  -
  -        //
  -        // Not recognized
  -        //
  -
  -        super.checkProperty(propertyId);
  -
  -    } // checkProperty(String)
  -
  -    //
  -    // Protected methods
  -    //
  -
  -    // factory methods
  -
  -    /** Create a document scanner. */
  -    protected XMLDocumentScanner createDocumentScanner() {
  -        return new XMLDocumentScanner();
  -    } // createDocumentScanner():XMLDocumentScanner
  -
  -    /** Create a DTD scanner. */
  -    protected XMLDTDScanner createDTDScanner() {
  -        return new XMLDTDScanner();
  -    } // createDTDScanner():XMLDTDScanner
  -
  -    /** Create a validator. */
  -    protected XMLValidator createValidator() {
  -        return new XMLValidator();
  -    } // createValidator():XMLValidator
  -
  -    /** Create a datatype validator factory. */
  -    protected DatatypeValidatorFactory createDatatypeValidatorFactory() {
  -        return new DatatypeValidatorFactoryImpl();
  -    } // createDatatypeValidatorFactory():DatatypeValidatorFactory
   
   } // class DOMParser
  
  
  
  1.12.2.22 +16 -350   xml-xerces/java/src/org/apache/xerces/parsers/SAXParser.java
  
  Index: SAXParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/SAXParser.java,v
  retrieving revision 1.12.2.21
  retrieving revision 1.12.2.22
  diff -u -r1.12.2.21 -r1.12.2.22
  --- SAXParser.java	2001/02/16 08:05:49	1.12.2.21
  +++ SAXParser.java	2001/02/26 23:32:20	1.12.2.22
  @@ -57,387 +57,53 @@
   
   package org.apache.xerces.parsers;
   
  -import java.io.IOException;
  -
  -import org.apache.xerces.impl.Constants;
  -import org.apache.xerces.impl.XMLDocumentScanner;
  -import org.apache.xerces.impl.XMLDTDScanner;
  -import org.apache.xerces.impl.XMLEntityManager;
  -import org.apache.xerces.impl.XMLInputSource;
  -import org.apache.xerces.impl.XMLValidator;
  -import org.apache.xerces.impl.validation.DatatypeValidatorFactory;
   import org.apache.xerces.impl.validation.GrammarPool;
  -import org.apache.xerces.impl.validation.datatypes.DatatypeValidatorFactoryImpl;
  -
   import org.apache.xerces.util.SymbolTable;
   
  -import org.xml.sax.InputSource;
  -import org.xml.sax.SAXException;
  -import org.xml.sax.SAXNotRecognizedException;
  -import org.xml.sax.SAXNotSupportedException;
  -
   /**
    * This is the main Xerces SAX parser class. It uses the abstract SAX parser
  - * with a document scanner, a dtd scanner, and a validator, as well as a
  - * grammar pool.
  + * with either a BasicConfiguration object or the one specified by the
  + * application.
    *
    * @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
    * @author Arnaud  Le Hors, IBM
    * @author Andy Clark, IBM
    *
  - * @version $Id: SAXParser.java,v 1.12.2.21 2001/02/16 08:05:49 andyc Exp $ */
  + * @version $Id: SAXParser.java,v 1.12.2.22 2001/02/26 23:32:20 lehors Exp $ */
   public class SAXParser
       extends AbstractSAXParser {
   
       //
  -    // Constants
  -    //
  -
  -    // debugging
  -
  -    /** Set to true and recompile to print exception stack trace. */
  -    private static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
  -
  -    //
  -    // Data
  -    //
  -
  -    // components (non-configurable)
  -
  -    /** Grammar pool. */
  -    protected GrammarPool fGrammarPool;
  -
  -    /** Datatype validator factory. */
  -    protected DatatypeValidatorFactory fDatatypeValidatorFactory;
  -
  -    // components (configurable)
  -
  -    /** Document scanner. */
  -    protected XMLDocumentScanner fScanner;
  -
  -    /** DTD scanner. */
  -    protected XMLDTDScanner fDTDScanner;
  -
  -    /** Validator. */
  -    protected XMLValidator fValidator;
  -
  -    //
       // Constructors
       //
   
       /**
  -     * Constructs a SAX parser.
  +     * Constructs a SAX parser using the default basic parser configuration.
        */
       public SAXParser() {
  +        super(new StandardParserConfiguration());
       } // <init>
   
       /**
  +     * Constructs a SAX parser using the specified parser configuration.
  +     */
  +    public SAXParser(ParserConfiguration config) {
  +        super(config);
  +    } // <init>(ParserConfiguration)
  +
  +    /**
        * Constructs a SAX parser using the specified symbol table.
        */
       public SAXParser(SymbolTable symbolTable) {
  -        super(symbolTable);
  +        super(new StandardParserConfiguration(symbolTable));
       } // <init>(SymbolTable)
   
       /**
  -     * Constructs a SAX parser using the specified symbol table and grammar
  -     * pool.
  +     * Constructs a SAX parser using the specified symbol table and
  +     * grammar pool.
        */
       public SAXParser(SymbolTable symbolTable, GrammarPool grammarPool) {
  -        super(symbolTable);
  -
  -        final String GRAMMAR_POOL = Constants.XERCES_PROPERTY_PREFIX + Constants.GRAMMAR_POOL_PROPERTY;
  -        fGrammarPool = new GrammarPool();
  -        fProperties.put(GRAMMAR_POOL, fGrammarPool);
  +        super(new StandardParserConfiguration(symbolTable, grammarPool));
       }
  -
  -    /**
  -     * Initialize the parser with all the components specified via the
  -     * properties plus any missing ones. This method MUST be called before
  -     * parsing. It is not called from the constructor though, so that the
  -     * application can pass in any components it wants by presetting the
  -     * relevant property.
  -     */
  -    public void initialize() {
  -        super.initialize();
  -
  -        // set default features
  -        final String NAMESPACES = Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
  -        fFeatures.put(NAMESPACES, Boolean.TRUE);
  -        final String VALIDATION = Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
  -        fFeatures.put(VALIDATION, Boolean.FALSE);
  -        final String EXTERNAL_GENERAL_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE;
  -        fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
  -        final String EXTERNAL_PARAMETER_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE;
  -        fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE);
  -
  -        // create and register missing components
  -        final String GRAMMAR_POOL = Constants.XERCES_PROPERTY_PREFIX + Constants.GRAMMAR_POOL_PROPERTY;
  -        fGrammarPool = (GrammarPool) fProperties.get(GRAMMAR_POOL);
  -        if (fGrammarPool == null) {
  -            fGrammarPool = new GrammarPool();
  -            fProperties.put(GRAMMAR_POOL, fGrammarPool);
  -        }
  -
  -        final String DOCUMENT_SCANNER = Constants.XERCES_PROPERTY_PREFIX + Constants.DOCUMENT_SCANNER_PROPERTY;
  -        fScanner = (XMLDocumentScanner) fProperties.get(DOCUMENT_SCANNER);
  -        if (fScanner == null) {
  -            fScanner = createDocumentScanner();
  -            fProperties.put(DOCUMENT_SCANNER, fScanner);
  -        }
  -        fComponents.addElement(fScanner);
  -
  -        final String DTD_SCANNER = Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;
  -        fDTDScanner = (XMLDTDScanner) fProperties.get(DTD_SCANNER);
  -        if (fDTDScanner == null) {
  -            fDTDScanner = createDTDScanner();
  -            fProperties.put(DTD_SCANNER, fDTDScanner);
  -        }
  -        fComponents.addElement(fDTDScanner);
  -
  -        final String VALIDATOR = Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATOR_PROPERTY;
  -        fValidator = (XMLValidator) fProperties.get(VALIDATOR);
  -        if (fValidator == null) {
  -            fValidator = createValidator();
  -            fProperties.put(VALIDATOR, fValidator);
  -        }
  -        fComponents.addElement(fValidator);
  -        
  -        final String DATATYPE_VALIDATOR_FACTORY = Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY;
  -        fDatatypeValidatorFactory = (DatatypeValidatorFactory)
  -            fProperties.get(DATATYPE_VALIDATOR_FACTORY);
  -        if (fDatatypeValidatorFactory == null) {
  -            fDatatypeValidatorFactory = createDatatypeValidatorFactory();
  -            fProperties.put(DATATYPE_VALIDATOR_FACTORY,
  -                            fDatatypeValidatorFactory);
  -        }
  -
  -    } // initialize()
  -
  -    //
  -    // XMLParser methods
  -    //
  -
  -    /** 
  -     * Reset all components before parsing. 
  -     *
  -     * @throws SAXException Thrown if an error occurs during initialization.
  -     */
  -    protected void reset() throws SAXException {
  -
  -        // setup document pipeline
  -        fScanner.setDocumentHandler(fValidator);
  -        fValidator.setDocumentHandler(this);
  -
  -        // setup dtd pipeline
  -        fDTDScanner.setDTDHandler(fValidator);
  -        fValidator.setDTDHandler(this);
  -
  -        // setup dtd content model pipeline
  -        fDTDScanner.setDTDContentModelHandler(fValidator);
  -        fValidator.setDTDContentModelHandler(this);
  -
  -        // the following will reset every component
  -        super.reset();
  -
  -    } // reset()
  -
  -    //
  -    // XMLReader methods
  -    //
  -
  -    /**
  -     * Parses the specified input source.
  -     *
  -     * @param source The input source.
  -     *
  -     * @exception org.xml.sax.SAXException Throws exception on SAX error.
  -     * @exception java.io.IOException Throws exception on i/o error.
  -     */
  -    public void parse(InputSource source)
  -        throws SAXException, IOException {
  -
  -        if (fParseInProgress) {
  -            // REVISIT - need to add new error message
  -            throw new SAXException("FWK005 parse may not be called while parsing.");
  -        }
  -        else if (fNeedInitialize) {
  -            initialize();
  -        }
  -
  -        try {
  -            reset();
  -            fEntityManager.setEntityHandler(fScanner);
  -            fEntityManager.startDocumentEntity(new XMLInputSource(source));
  -            fScanner.scanDocument(true);
  -            fParseInProgress = false;
  -        } 
  -        catch (SAXException ex) {
  -            fParseInProgress = false;
  -            if (PRINT_EXCEPTION_STACK_TRACE)
  -                ex.printStackTrace();
  -            throw ex;
  -        } 
  -        catch (IOException ex) {
  -            fParseInProgress = false;
  -            if (PRINT_EXCEPTION_STACK_TRACE)
  -                ex.printStackTrace();
  -            throw ex;
  -        } 
  -        catch (Exception ex) {
  -            fParseInProgress = false;
  -            if (PRINT_EXCEPTION_STACK_TRACE)
  -                ex.printStackTrace();
  -            throw new org.xml.sax.SAXException(ex);
  -        }
  -
  -    } // parse(InputSource)
  -
  -    //
  -    // XMLParser methods
  -    //
  -
  -    /**
  -     * Check a feature. If feature is know and supported, this method simply
  -     * returns. Otherwise, the appropriate exception is thrown.
  -     *
  -     * @param featureId The unique identifier (URI) of the feature.
  -     *
  -     * @exception org.xml.sax.SAXNotRecognizedException If the
  -     *            requested feature is not known.
  -     * @exception org.xml.sax.SAXNotSupportedException If the
  -     *            requested feature is known, but the requested
  -     *            state is not supported.
  -     * @exception org.xml.sax.SAXException If there is any other
  -     *            problem fulfilling the request.
  -     */
  -    protected void checkFeature(String featureId)
  -        throws SAXNotRecognizedException, SAXNotSupportedException {
  -
  -        //
  -        // Xerces Features
  -        //
  -
  -        if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
  -            String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
  -            //
  -            // http://apache.org/xml/features/validation/schema
  -            //   Lets the user turn Schema validation support on/off.
  -            //
  -            if (feature.equals(Constants.SCHEMA_VALIDATION_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/dynamic
  -            //   Allows the parser to validate a document only when it
  -            //   contains a grammar. Validation is turned on/off based
  -            //   on each document instance, automatically.
  -            //
  -            if (feature.equals(Constants.DYNAMIC_VALIDATION_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/default-attribute-values
  -            //
  -            if (feature.equals(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) {
  -                // REVISIT
  -                throw new SAXNotSupportedException(featureId);
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/default-attribute-values
  -            //
  -            if (feature.equals(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) {
  -                // REVISIT
  -                throw new SAXNotSupportedException(featureId);
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar
  -            //
  -            if (feature.equals(Constants.LOAD_DTD_GRAMMAR_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/nonvalidating/load-external-dtd
  -            //
  -            if (feature.equals(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
  -                return;
  -            }
  -
  -            //
  -            // http://apache.org/xml/features/validation/default-attribute-values
  -            //
  -            if (feature.equals(Constants.VALIDATE_DATATYPES_FEATURE)) {
  -                throw new SAXNotSupportedException(featureId);
  -            }
  -        }
  -
  -        //
  -        // Not recognized
  -        //
  -
  -        super.checkFeature(featureId);
  -
  -    } // checkFeature(String)
  -
  -    /**
  -     * Check a property. If the property is know and supported, this method
  -     * simply returns. Otherwise, the appropriate exception is thrown.
  -     *
  -     * @param propertyId The unique identifier (URI) of the property
  -     *                   being set.
  -     * @exception org.xml.sax.SAXNotRecognizedException If the
  -     *            requested property is not known.
  -     * @exception org.xml.sax.SAXNotSupportedException If the
  -     *            requested property is known, but the requested
  -     *            value is not supported.
  -     * @exception org.xml.sax.SAXException If there is any other
  -     *            problem fulfilling the request.
  -     */
  -    protected void checkProperty(String propertyId)
  -        throws SAXNotRecognizedException, SAXNotSupportedException {
  -
  -        //
  -        // Xerces Properties
  -        //
  -
  -        if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
  -            String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
  -            if (property.equals(Constants.DTD_SCANNER_PROPERTY)) {
  -                return;
  -            }
  -        }
  -
  -        //
  -        // Not recognized
  -        //
  -
  -        super.checkProperty(propertyId);
  -
  -    } // checkProperty(String)
  -
  -    //
  -    // Protected methods
  -    //
  -
  -    // factory methods
  -
  -    /** Create a document scanner. */
  -    protected XMLDocumentScanner createDocumentScanner() {
  -        return new XMLDocumentScanner();
  -    } // createDocumentScanner():XMLDocumentScanner
  -
  -    /** Create a DTD scanner. */
  -    protected XMLDTDScanner createDTDScanner() {
  -        return new XMLDTDScanner();
  -    } // createDTDScanner():XMLDTDScanner
  -
  -    /** Create a validator. */
  -    protected XMLValidator createValidator() {
  -        return new XMLValidator();
  -    } // createValidator():XMLValidator
  -
  -    /** Create a datatype validator factory. */
  -    protected DatatypeValidatorFactory createDatatypeValidatorFactory() {
  -        return new DatatypeValidatorFactoryImpl();
  -    } // createDatatypeValidatorFactory():DatatypeValidatorFactory
   
   } // class SAXParser
  
  
  
  1.1.2.36  +15 -349   xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLDocumentParser.java
  
  Index: XMLDocumentParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLDocumentParser.java,v
  retrieving revision 1.1.2.35
  retrieving revision 1.1.2.36
  diff -u -r1.1.2.35 -r1.1.2.36
  --- XMLDocumentParser.java	2001/02/16 08:05:49	1.1.2.35
  +++ XMLDocumentParser.java	2001/02/26 23:32:20	1.1.2.36
  @@ -57,86 +57,46 @@
   
   package org.apache.xerces.parsers;
   
  -import java.io.IOException;
  -
  -import org.apache.xerces.impl.Constants;
  -import org.apache.xerces.impl.XMLDocumentScanner;
  -import org.apache.xerces.impl.XMLDTDScanner;
  -import org.apache.xerces.impl.XMLEntityManager;
  -import org.apache.xerces.impl.XMLInputSource;
  -import org.apache.xerces.impl.XMLValidator;
  -import org.apache.xerces.impl.validation.DatatypeValidatorFactory;
   import org.apache.xerces.impl.validation.GrammarPool;
  -import org.apache.xerces.impl.validation.datatypes.DatatypeValidatorFactoryImpl;
  -
   import org.apache.xerces.util.SymbolTable;
   
  -import org.xml.sax.InputSource;
  -import org.xml.sax.SAXException;
  -import org.xml.sax.SAXNotRecognizedException;
  -import org.xml.sax.SAXNotSupportedException;
  -
   /**
    * This is a concrete vanilla XML parser class. It uses the abstract parser
  - * with a document scanner, a dtd scanner, and a validator, as well as a
  - * grammar pool.
  + * with either a BasicConfiguration object or the one specified by the
  + * application.
    *
    * @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
    * @author Arnaud  Le Hors, IBM
    * @author Andy Clark, IBM
    *
  - * @version $Id: XMLDocumentParser.java,v 1.1.2.35 2001/02/16 08:05:49 andyc Exp $ */
  + * @version $Id: XMLDocumentParser.java,v 1.1.2.36 2001/02/26 23:32:20 lehors Exp $ */
   public class XMLDocumentParser
       extends AbstractXMLDocumentParser {
   
       //
  -    // Constants
  -    //
  -
  -    // debugging
  -
  -    /** Set to true and recompile to print exception stack trace. */
  -    private static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
  -
  -    //
  -    // Data
  -    //
  -
  -    // components (non-configurable)
  -
  -    /** Grammar pool. */
  -    protected GrammarPool fGrammarPool;
  -
  -    /** Datatype validator factory. */
  -    protected DatatypeValidatorFactory fDatatypeValidatorFactory;
  -
  -    // components (configurable)
  -
  -    /** Document scanner. */
  -    protected XMLDocumentScanner fScanner;
  -
  -    /** DTD scanner. */
  -    protected XMLDTDScanner fDTDScanner;
  -
  -    /** Validator. */
  -    protected XMLValidator fValidator;
  -
  -    //
       // Constructors
       //
   
       /**
  -     * Constructs a document parser using the default symbol table and grammar
  -     * pool or the ones specified by the application (through the properties).
  +     * Constructs a document parser using the default basic parser
  +     * configuration.
        */
       public XMLDocumentParser() {
  +        super(new StandardParserConfiguration());
       } // <init>
   
       /**
  +     * Constructs a document parser using the specified parser configuration.
  +     */
  +    public XMLDocumentParser(ParserConfiguration config) {
  +        super(config);
  +    } // <init>(ParserConfiguration)
  +
  +    /**
        * Constructs a document parser using the specified symbol table.
        */
       public XMLDocumentParser(SymbolTable symbolTable) {
  -        super(symbolTable);
  +        super(new StandardParserConfiguration(symbolTable));
       } // <init>(SymbolTable)
   
       /**
  @@ -145,301 +105,7 @@
        */
       public XMLDocumentParser(SymbolTable symbolTable,
                                GrammarPool grammarPool) {
  -        super(symbolTable);
  -
  -        final String GRAMMAR_POOL = Constants.XERCES_PROPERTY_PREFIX + Constants.GRAMMAR_POOL_PROPERTY;
  -        fGrammarPool = new GrammarPool();
  -        fProperties.put(GRAMMAR_POOL, fGrammarPool);
  +        super(new StandardParserConfiguration(symbolTable, grammarPool));
       }
  -
  -    /**
  -     * Initialize the parser with all the components specified via the
  -     * properties plus any missing ones. This method MUST be called before
  -     * parsing. It is not called from the constructor though, so that the
  -     * application can pass in any components it wants by presetting the
  -     * relevant property.
  -     */
  -    public void initialize() {
  -        super.initialize();
  -
  -        // set default features
  -        final String NAMESPACES = Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
  -        fFeatures.put(NAMESPACES, Boolean.TRUE);
  -        final String VALIDATION = Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
  -        fFeatures.put(VALIDATION, Boolean.FALSE);
  -        final String EXTERNAL_GENERAL_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE;
  -        fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
  -        final String EXTERNAL_PARAMETER_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE;
  -        fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE);
  -
  -        // create and register missing components
  -        final String GRAMMAR_POOL = Constants.XERCES_PROPERTY_PREFIX + Constants.GRAMMAR_POOL_PROPERTY;
  -        fGrammarPool = (GrammarPool) fProperties.get(GRAMMAR_POOL);
  -        if (fGrammarPool == null) {
  -            fGrammarPool = new GrammarPool();
  -            fProperties.put(GRAMMAR_POOL, fGrammarPool);
  -        }
  -
  -        final String DOCUMENT_SCANNER = Constants.XERCES_PROPERTY_PREFIX + Constants.DOCUMENT_SCANNER_PROPERTY;
  -        fScanner = (XMLDocumentScanner) fProperties.get(DOCUMENT_SCANNER);
  -        if (fScanner == null) {
  -            fScanner = createDocumentScanner();
  -            fProperties.put(DOCUMENT_SCANNER, fScanner);
  -        }
  -        fComponents.addElement(fScanner);
  -
  -        final String DTD_SCANNER = Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;
  -        fDTDScanner = (XMLDTDScanner) fProperties.get(DTD_SCANNER);
  -        if (fDTDScanner == null) {
  -            fDTDScanner = createDTDScanner();
  -            fProperties.put(DTD_SCANNER, fDTDScanner);
  -        }
  -        fComponents.addElement(fDTDScanner);
  -
  -        final String VALIDATOR = Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATOR_PROPERTY;
  -        fValidator = (XMLValidator) fProperties.get(VALIDATOR);
  -        if (fValidator == null) {
  -            fValidator = createValidator();
  -            fProperties.put(VALIDATOR, fValidator);
  -        }
  -        fComponents.addElement(fValidator);
  -        
  -        final String DATATYPE_VALIDATOR_FACTORY = Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY;
  -        fDatatypeValidatorFactory = (DatatypeValidatorFactory)
  -            fProperties.get(DATATYPE_VALIDATOR_FACTORY);
  -        if (fDatatypeValidatorFactory == null) {
  -            fDatatypeValidatorFactory = createDatatypeValidatorFactory();
  -            fProperties.put(DATATYPE_VALIDATOR_FACTORY,
  -                            fDatatypeValidatorFactory);
  -        }
  -
  -    } // initialize()
  -
  -    //
  -    // XMLParser methods
  -    //
  -
  -    /** 
  -     * Reset all components before parsing. 
  -     *
  -     * @throws SAXException Thrown if an error occurs during initialization.
  -     */
  -    protected void reset() throws SAXException {
  -
  -        // setup document pipeline
  -        fScanner.setDocumentHandler(fValidator);
  -        fValidator.setDocumentHandler(this);
  -
  -        // setup dtd pipeline
  -        fDTDScanner.setDTDHandler(fValidator);
  -        fValidator.setDTDHandler(this);
  -
  -        // setup dtd content model pipeline
  -        fDTDScanner.setDTDContentModelHandler(fValidator);
  -        fValidator.setDTDContentModelHandler(this);
  -
  -        // the following will reset every component
  -        super.reset();
  -
  -    } // reset()
  -
  -    //
  -    // XMLReader methods
  -    //
  -
  -    /**
  -     * Parses the specified input source.
  -     *
  -     * @param source The input source.
  -     *
  -     * @exception org.xml.sax.SAXException Throws exception on SAX error.
  -     * @exception java.io.IOException Throws exception on i/o error.
  -     */
  -    public void parse(InputSource source)
  -        throws SAXException, IOException {
  -
  -        if (fParseInProgress) {
  -            // REVISIT - need to add new error message
  -            throw new SAXException("FWK005 parse may not be called while parsing.");
  -        }
  -        else if (fNeedInitialize) {
  -            initialize();
  -        }
  -
  -        try {
  -            reset();
  -            fEntityManager.setEntityHandler(fScanner);
  -            fEntityManager.startDocumentEntity(new XMLInputSource(source));
  -            fScanner.scanDocument(true);
  -            fParseInProgress = false;
  -        } 
  -        catch (SAXException ex) {
  -            fParseInProgress = false;
  -            if (PRINT_EXCEPTION_STACK_TRACE)
  -                ex.printStackTrace();
  -            throw ex;
  -        } 
  -        catch (IOException ex) {
  -            fParseInProgress = false;
  -            if (PRINT_EXCEPTION_STACK_TRACE)
  -                ex.printStackTrace();
  -            throw ex;
  -        } 
  -        catch (Exception ex) {
  -            fParseInProgress = false;
  -            if (PRINT_EXCEPTION_STACK_TRACE)
  -                ex.printStackTrace();
  -            throw new org.xml.sax.SAXException(ex);
  -        }
  -
  -    } // parse(InputSource)
  -
  -    //
  -    // XMLParser methods
  -    //
  -
  -    /**
  -     * Check a feature. If feature is know and supported, this method simply
  -     * returns. Otherwise, the appropriate exception is thrown.
  -     *
  -     * @param featureId The unique identifier (URI) of the feature.
  -     *
  -     * @exception org.xml.sax.SAXNotRecognizedException If the
  -     *            requested feature is not known.
  -     * @exception org.xml.sax.SAXNotSupportedException If the
  -     *            requested feature is known, but the requested
  -     *            state is not supported.
  -     * @exception org.xml.sax.SAXException If there is any other
  -     *            problem fulfilling the request.
  -     */
  -    protected void checkFeature(String featureId)
  -        throws SAXNotRecognizedException, SAXNotSupportedException {
  -
  -        //
  -        // Xerces Features
  -        //
  -
  -        if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
  -            String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
  -            //
  -            // http://apache.org/xml/features/validation/schema
  -            //   Lets the user turn Schema validation support on/off.
  -            //
  -            if (feature.equals(Constants.SCHEMA_VALIDATION_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/dynamic
  -            //   Allows the parser to validate a document only when it
  -            //   contains a grammar. Validation is turned on/off based
  -            //   on each document instance, automatically.
  -            //
  -            if (feature.equals(Constants.DYNAMIC_VALIDATION_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/default-attribute-values
  -            //
  -            if (feature.equals(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) {
  -                // REVISIT
  -                throw new SAXNotSupportedException(featureId);
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/default-attribute-values
  -            //
  -            if (feature.equals(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) {
  -                // REVISIT
  -                throw new SAXNotSupportedException(featureId);
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar
  -            //
  -            if (feature.equals(Constants.LOAD_DTD_GRAMMAR_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/nonvalidating/load-external-dtd
  -            //
  -            if (feature.equals(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
  -                return;
  -            }
  -
  -            //
  -            // http://apache.org/xml/features/validation/default-attribute-values
  -            //
  -            if (feature.equals(Constants.VALIDATE_DATATYPES_FEATURE)) {
  -                throw new SAXNotSupportedException(featureId);
  -            }
  -        }
  -
  -        //
  -        // Not recognized
  -        //
  -
  -        super.checkFeature(featureId);
  -
  -    } // checkFeature(String)
  -
  -    /**
  -     * Check a property. If the property is know and supported, this method
  -     * simply returns. Otherwise, the appropriate exception is thrown.
  -     *
  -     * @param propertyId The unique identifier (URI) of the property
  -     *                   being set.
  -     * @exception org.xml.sax.SAXNotRecognizedException If the
  -     *            requested property is not known.
  -     * @exception org.xml.sax.SAXNotSupportedException If the
  -     *            requested property is known, but the requested
  -     *            value is not supported.
  -     * @exception org.xml.sax.SAXException If there is any other
  -     *            problem fulfilling the request.
  -     */
  -    protected void checkProperty(String propertyId)
  -        throws SAXNotRecognizedException, SAXNotSupportedException {
  -
  -        //
  -        // Xerces Properties
  -        //
  -
  -        if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
  -            String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
  -            if (property.equals(Constants.DTD_SCANNER_PROPERTY)) {
  -                return;
  -            }
  -        }
  -
  -        //
  -        // Not recognized
  -        //
  -
  -        super.checkProperty(propertyId);
  -
  -    } // checkProperty(String)
  -
  -    //
  -    // Protected methods
  -    //
  -
  -    // factory methods
  -
  -    /** Create a document scanner. */
  -    protected XMLDocumentScanner createDocumentScanner() {
  -        return new XMLDocumentScanner();
  -    } // createDocumentScanner():XMLDocumentScanner
  -
  -    /** Create a DTD scanner. */
  -    protected XMLDTDScanner createDTDScanner() {
  -        return new XMLDTDScanner();
  -    } // createDTDScanner():XMLDTDScanner
  -
  -    /** Create a validator. */
  -    protected XMLValidator createValidator() {
  -        return new XMLValidator();
  -    } // createValidator():XMLValidator
  -
  -    /** Create a datatype validator factory. */
  -    protected DatatypeValidatorFactory createDatatypeValidatorFactory() {
  -        return new DatatypeValidatorFactoryImpl();
  -    } // createDatatypeValidatorFactory():DatatypeValidatorFactory
   
   } // class XMLDocumentParser
  
  
  
  1.1.2.8   +3 -3      xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLGrammarParser.java
  
  Index: XMLGrammarParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLGrammarParser.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- XMLGrammarParser.java	2000/10/14 02:31:48	1.1.2.7
  +++ XMLGrammarParser.java	2001/02/26 23:32:20	1.1.2.8
  @@ -65,7 +65,7 @@
   
   /**
    * @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
  - * @version $Id: XMLGrammarParser.java,v 1.1.2.7 2000/10/14 02:31:48 lehors Exp $
  + * @version $Id: XMLGrammarParser.java,v 1.1.2.8 2001/02/26 23:32:20 lehors Exp $
    */
   public abstract class XMLGrammarParser
       extends XMLParser
  @@ -83,12 +83,12 @@
       //
   
       /**
  +     * Construct an XMLGrammarParser with the specified symbol table
        * 
  -     * 
        * @param symbolTable 
        */
       protected XMLGrammarParser(SymbolTable symbolTable) {
  -        super(symbolTable);
  +        super(new StandardParserConfiguration(symbolTable));
       }
   
       //
  
  
  
  1.1.2.22  +31 -440   xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLParser.java
  
  Index: XMLParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLParser.java,v
  retrieving revision 1.1.2.21
  retrieving revision 1.1.2.22
  diff -u -r1.1.2.21 -r1.1.2.22
  --- XMLParser.java	2001/02/16 08:05:49	1.1.2.21
  +++ XMLParser.java	2001/02/26 23:32:20	1.1.2.22
  @@ -57,94 +57,33 @@
   
   package org.apache.xerces.parsers;
   
  -import java.io.InputStream;
   import java.io.IOException;
  -import java.io.Reader;
  -import java.util.Hashtable;
   import java.util.Locale;
  -import java.util.Vector;
   
  -import org.apache.xerces.impl.Constants;
  -import org.apache.xerces.impl.XMLEntityManager;
  -import org.apache.xerces.impl.XMLErrorReporter;
  -import org.apache.xerces.impl.msg.XMLMessageFormatter;
  -import org.apache.xerces.util.SymbolTable;
  -import org.apache.xerces.xni.XMLComponent;
  -import org.apache.xerces.xni.XMLComponentManager;
  -
   import org.xml.sax.EntityResolver;
   import org.xml.sax.ErrorHandler;
   import org.xml.sax.InputSource;
  -import org.xml.sax.Locator;
   import org.xml.sax.SAXException;
   import org.xml.sax.SAXNotRecognizedException;
   import org.xml.sax.SAXNotSupportedException;
   
   /**
    * Base class of all XML-related parsers.
  - * <p>
  - * This class sets the defaults for the following features and properties:
  - * <ul>
  - * <li>http://xml.org/sax/features/validation</li>
  - * <li>http://xml.org/sax/features/namespaces</li>
  - * <li>http://xml.org/sax/features/external-general-entities</li>
  - * <li>http://xml.org/sax/features/external-parameter-entities</li>
  - * <li>http://apache.org/xml/features/validation/warn-on-duplicate-attdef</li>
  - * <li>http://apache.org/xml/features/validation/warn-on-undeclared-elemdef</li>
  - * <li>http://apache.org/xml/features/allow-java-encodings</li>
  - * <li>http://apache.org/xml/features/continue-after-fatal-error</li>
  - * <li>http://xml.org/sax/properties/xml-string</li>
  - * <li>http://apache.org/xml/properties/internal/symbol-table</li>
  - * <li>http://apache.org/xml/properties/internal/error-reporter</li>
  - * <li>http://apache.org/xml/properties/internal/error-handler</li>
  - * <li>http://apache.org/xml/properties/internal/entity-manager</li>
  - * <li>http://apache.org/xml/properties/internal/entity-resolver</li>
  - * <li>http://apache.org/xml/properties/internal/grammar-pool</li>
  - * <li>http://apache.org/xml/properties/internal/datatype-validator-factory</li>
  - * </ul>
    *
    * @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
    * @author Arnaud  Le Hors, IBM
    * @author Andy Clark, IBM
    *
  - * @version $Id: XMLParser.java,v 1.1.2.21 2001/02/16 08:05:49 andyc Exp $
  + * @version $Id: XMLParser.java,v 1.1.2.22 2001/02/26 23:32:20 lehors Exp $
    */
  -public abstract class XMLParser
  -    implements XMLComponentManager {
  +public abstract class XMLParser {
   
       //
       // Data
       //
  -
  -    // components (non-configurable)
  -
  -    /** Symbol table. */
  -    protected SymbolTable fSymbolTable;
  -
  -    /** Locator */
  -    protected Locator fLocator;
  -
  -    // components (configurable)
  -
  -    /** Entity manager. */
  -    protected XMLEntityManager fEntityManager;
  -
  -    /** Error reporter. */
  -    protected XMLErrorReporter fErrorReporter;
   
  -    // data
  +    ParserConfiguration fConfiguration;
   
  -    /** Properties. */
  -    protected Hashtable fProperties;
  -
  -    /** Features. */
  -    protected Hashtable fFeatures;
  -
  -    /** Components. */
  -    protected Vector fComponents;
  -
  -    protected boolean fNeedInitialize;
  -
       //
       // Constructors
       //
  @@ -152,102 +91,12 @@
       /**
        * Default Constructor.
        */
  -    protected XMLParser() {
  +    protected XMLParser(ParserConfiguration config) {
   
  -        // create a vector to hold all the components in use
  -        fComponents = new Vector();
  +        fConfiguration = config;
   
  -        // create table for features and properties
  -        fFeatures = new Hashtable();
  -        fProperties = new Hashtable();
  -
  -        // set default values for features
  -        final String VALIDATION = Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
  -        fFeatures.put(VALIDATION, Boolean.FALSE);
  -        final String NAMESPACES = Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
  -        fFeatures.put(NAMESPACES, Boolean.TRUE);
  -        final String EXTERNAL_GENERAL_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE;
  -        fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
  -        final String EXTERNAL_PARAMETER_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE;
  -        fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE);
  -        final String WARN_ON_DUPLICATE_ATTDEF = Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ATTDEF_FEATURE;
  -        fFeatures.put(WARN_ON_DUPLICATE_ATTDEF, Boolean.FALSE);
  -        final String WARN_ON_UNDECLARED_ELEMDEF = Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE;
  -        fFeatures.put(WARN_ON_UNDECLARED_ELEMDEF, Boolean.FALSE);
  -        final String ALLOW_JAVA_ENCODINGS = Constants.XERCES_FEATURE_PREFIX + Constants.ALLOW_JAVA_ENCODINGS_FEATURE;
  -        fFeatures.put(ALLOW_JAVA_ENCODINGS, Boolean.FALSE);
  -        final String CONTINUE_AFTER_FATAL_ERROR = Constants.XERCES_FEATURE_PREFIX + Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE;
  -        fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
  -        final String LOAD_EXTERNAL_DTD = Constants.XERCES_FEATURE_PREFIX + Constants.LOAD_EXTERNAL_DTD_FEATURE;
  -        fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE);
  -
  -        fNeedInitialize = true;
  -
  -    } // <init>
  -
  -    /**
  -     * Constructs a document parser using the specified symbol table
  -     * and a default grammar pool.
  -     *
  -     */
  -    protected XMLParser(SymbolTable symbolTable) {
  -        this();
  -        final String SYMBOL_TABLE = Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
  -        fSymbolTable = new SymbolTable();
  -        fProperties.put(SYMBOL_TABLE, fSymbolTable);
  -    } // <init>(SymbolTable)
  -
  -    /**
  -     * Initialize the parser with all the components specified via the
  -     * properties plus any missing ones. This method MUST be called before
  -     * parsing. It is not called from the constructor though, so that the
  -     * application can pass in any components it wants by presetting the
  -     * relevant property.
  -     */
  -    protected void initialize() {
  -
  -        // create and register missing components
  -        final String SYMBOL_TABLE = Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
  -        fSymbolTable = (SymbolTable) fProperties.get(SYMBOL_TABLE);
  -        if (fSymbolTable == null) {
  -            fSymbolTable = new SymbolTable();
  -            fProperties.put(SYMBOL_TABLE, fSymbolTable);
  -        }
  -
  -        final String ENTITY_MANAGER = Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
  -        fEntityManager = (XMLEntityManager) fProperties.get(ENTITY_MANAGER);
  -        if (fEntityManager == null) {
  -            fEntityManager = createEntityManager();
  -            fProperties.put(ENTITY_MANAGER, fEntityManager);
  -        }
  -        fComponents.addElement(fEntityManager);
  -
  -        final String ERROR_REPORTER = Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
  -        fErrorReporter = (XMLErrorReporter) fProperties.get(ERROR_REPORTER);
  -        if (fErrorReporter == null) {
  -            fErrorReporter =
  -                createErrorReporter(fEntityManager.getEntityScanner());
  -            fProperties.put(ERROR_REPORTER, fErrorReporter);
  -        }
  -        fComponents.addElement(fErrorReporter);
  -
  -        fLocator = (Locator) fEntityManager.getEntityScanner();
  -
  -        XMLMessageFormatter xmft = new XMLMessageFormatter();
  -        fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
  -        fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
  -
  -        // set locale
  -        try {
  -            setLocale(Locale.getDefault());
  -        }
  -        catch (SAXException e) {
  -            // ignore
  -        }
  -        fNeedInitialize = false;
  +    } // <init>(ParserConfiguration)
   
  -    } // initialize()
  -
       //
       // Public methods
       //
  @@ -268,23 +117,7 @@
       public void parse(String systemId)
           throws SAXException, IOException {
   
  -        InputSource source = new InputSource(systemId);
  -        parse(source);
  -        try {
  -            Reader reader = source.getCharacterStream();
  -            if (reader != null) {
  -                reader.close();
  -            }
  -            else {
  -                InputStream is = source.getByteStream();
  -                if (is != null) {
  -                    is.close();
  -                }
  -            }
  -        }
  -        catch (IOException e) {
  -            // ignore
  -        }
  +        fConfiguration.parse(systemId);
   
       } // parse(String)
   
  @@ -296,9 +129,13 @@
        * @exception org.xml.sax.SAXException
        * @exception java.io.IOException
        */
  -    public abstract void parse(InputSource inputSource) 
  -        throws SAXException, IOException;
  +    public void parse(InputSource inputSource) 
  +        throws SAXException, IOException {
  +
  +        fConfiguration.parse(inputSource);
   
  +    } // parse(InputSource) 
  +
       /**
        * Sets the resolver used to resolve external entities. The EntityResolver
        * interface supports resolution of public and system identifiers.
  @@ -307,8 +144,9 @@
        *                 uninstall the currently installed resolver.
        */
       public void setEntityResolver(EntityResolver resolver) {
  -        final String ENTITY_RESOLVER = Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
  -        fProperties.put(ENTITY_RESOLVER, resolver);
  +
  +        fConfiguration.setEntityResolver(resolver);
  +
       } // setEntityResolver(EntityResolver)
   
       /**
  @@ -319,8 +157,9 @@
        * @see #setEntityResolver
        */
       public EntityResolver getEntityResolver() {
  -        final String ENTITY_RESOLVER = Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
  -        return (EntityResolver)fProperties.get(ENTITY_RESOLVER);
  +
  +        return fConfiguration.getEntityResolver();
  +
       } // getEntityResolver():EntityResolver
   
       /**
  @@ -342,8 +181,9 @@
        * @see #getErrorHandler
        */
       public void setErrorHandler(ErrorHandler errorHandler) {
  -        final String ERROR_HANDLER = Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
  -        fProperties.put(ERROR_HANDLER, errorHandler);
  +
  +        fConfiguration.setErrorHandler(errorHandler);
  +
       } // setErrorHandler(ErrorHandler)
   
       /**
  @@ -354,8 +194,9 @@
        * @see #setErrorHandler
        */
       public ErrorHandler getErrorHandler() {
  -        final String ERROR_HANDLER = Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
  -        return (ErrorHandler)fProperties.get(ERROR_HANDLER);
  +
  +        return fConfiguration.getErrorHandler();
  +
       } // getErrorHandler():ErrorHandler
   
       /**
  @@ -378,17 +219,8 @@
        */
       public void setFeature(String featureId, boolean state)
           throws SAXNotRecognizedException, SAXNotSupportedException {
  -
  -        checkFeature(featureId);
   
  -        // forward to every component
  -        int count = fComponents.size();
  -        for (int i = 0; i < count; i++) {
  -            XMLComponent c = (XMLComponent) fComponents.elementAt(i);
  -            c.setFeature(featureId, state);
  -        }
  -        // then store the information
  -        fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE);
  +        fConfiguration.setFeature(featureId, state);
   
       } // setFeature(String,boolean)
   
  @@ -401,17 +233,8 @@
       public void setProperty(String propertyId, Object value)
           throws SAXNotRecognizedException, SAXNotSupportedException {
   
  -        checkProperty(propertyId);
  +        fConfiguration.setProperty(propertyId, value);
   
  -        // forward to every component
  -        int count = fComponents.size();
  -        for (int i = 0; i < count; i++) {
  -            XMLComponent c = (XMLComponent) fComponents.elementAt(i);
  -            c.setProperty(propertyId, value);
  -        }
  -        // then store the information
  -        fProperties.put(propertyId, value);
  -
       } // setProperty(String,Object)
   
       /**
  @@ -426,7 +249,7 @@
        */
       public void setLocale(Locale locale) throws SAXException {
   
  -        fErrorReporter.setLocale(locale);
  +        fConfiguration.setLocale(locale);
   
       } // setLocale(Locale)
   
  @@ -446,11 +269,8 @@
        */
       public boolean getFeature(String featureId)
           throws SAXNotRecognizedException, SAXNotSupportedException {
  -
  -        checkFeature(featureId);
   
  -        Boolean state = (Boolean) fFeatures.get(featureId);
  -        return state.booleanValue();
  +        return fConfiguration.getFeature(featureId);
   
       } // getFeature(String):boolean
   
  @@ -466,10 +286,8 @@
        */
       public Object getProperty(String propertyId)
           throws SAXNotRecognizedException, SAXNotSupportedException {
  -
  -        checkProperty(propertyId);
   
  -        return fProperties.get(propertyId);
  +        return fConfiguration.getProperty(propertyId);
   
       } // getProperty(String):Object
   
  @@ -482,235 +300,8 @@
        */
       protected void reset() throws SAXException {
   
  -        // reset every component
  -        int count = fComponents.size();
  -        for (int i = 0; i < count; i++) {
  -            XMLComponent c = (XMLComponent) fComponents.elementAt(i);
  -            c.reset(this);
  -        }
  +        fConfiguration.reset();
   
       } // reset()
  -
  -    /**
  -     * Check a feature. If feature is known and supported, this method simply
  -     * returns. Otherwise, the appropriate exception is thrown.
  -     *
  -     * @param featureId The unique identifier (URI) of the feature.
  -     *
  -     * @exception org.xml.sax.SAXNotRecognizedException If the
  -     *            requested feature is not known.
  -     * @exception org.xml.sax.SAXNotSupportedException If the
  -     *            requested feature is known, but the requested
  -     *            state is not supported.
  -     * @exception org.xml.sax.SAXException If there is any other
  -     *            problem fulfilling the request.
  -     */
  -    protected void checkFeature(String featureId)
  -        throws SAXNotRecognizedException, SAXNotSupportedException {
  -
  -        //
  -        // SAX2 Features
  -        //
  -
  -        if (featureId.startsWith(Constants.SAX_FEATURE_PREFIX)) {
  -            String feature =
  -                featureId.substring(Constants.SAX_FEATURE_PREFIX.length());
  -            //
  -            // http://xml.org/sax/features/validation
  -            //   Validate (true) or don't validate (false).
  -            //
  -            if (feature.equals(Constants.VALIDATION_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://xml.org/sax/features/namespaces
  -            //   Preprocess namespaces (true) or not (false).  See also
  -            //   the http://xml.org/sax/properties/namespace-sep property.
  -            //
  -            if (feature.equals(Constants.NAMESPACES_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://xml.org/sax/features/external-general-entities
  -            //   Expand external general entities (true) or not (false).
  -            //
  -            if (feature.equals(Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://xml.org/sax/features/external-parameter-entities
  -            //   Expand external parameter entities (true) or not (false).
  -            //
  -            if (feature.equals(Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // Not recognized
  -            //
  -        }
  -
  -        //
  -        // Xerces Features
  -        //
  -
  -        else if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
  -            String feature =
  -                featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
  -            //
  -            // http://apache.org/xml/features/validation/warn-on-duplicate-attdef
  -            //   Emits an error when an attribute is redefined.
  -            //
  -            if (feature.equals(Constants.WARN_ON_DUPLICATE_ATTDEF_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/validation/warn-on-undeclared-elemdef
  -            //   Emits an error when an element's content model
  -            //   references an element, by name, that is not declared
  -            //   in the grammar.
  -            //
  -            if (feature.equals(Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/allow-java-encodings
  -            //   Allows the use of Java encoding names in the XML
  -            //   and TextDecl lines.
  -            //
  -            if (feature.equals(Constants.ALLOW_JAVA_ENCODINGS_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/features/continue-after-fatal-error
  -            //   Allows the parser to continue after a fatal error.
  -            //   Normally, a fatal error would stop the parse.
  -            //
  -            if (feature.equals(Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE)) {
  -                return;
  -            }
  -            //
  -            // Not recognized
  -            //
  -        }
  -
  -        //
  -        // Not recognized
  -        //
  -
  -        throw new SAXNotRecognizedException(featureId);
  -
  -    } // checkFeature(String)
  -
  -    /**
  -     * Check a property. If the property is known and supported, this method
  -     * simply returns. Otherwise, the appropriate exception is thrown.
  -     *
  -     * @param propertyId The unique identifier (URI) of the property
  -     *                   being set.
  -     * @exception org.xml.sax.SAXNotRecognizedException If the
  -     *            requested property is not known.
  -     * @exception org.xml.sax.SAXNotSupportedException If the
  -     *            requested property is known, but the requested
  -     *            value is not supported.
  -     * @exception org.xml.sax.SAXException If there is any other
  -     *            problem fulfilling the request.
  -     */
  -    protected void checkProperty(String propertyId)
  -        throws SAXNotRecognizedException, SAXNotSupportedException {
  -
  -        //
  -        // SAX2 Properties
  -        //
  -
  -        if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
  -            String property =
  -                propertyId.substring(Constants.SAX_PROPERTY_PREFIX.length());
  -            //
  -            // http://xml.org/sax/properties/xml-string
  -            // Value type: String
  -            // Access: read-only
  -            //   Get the literal string of characters associated with the
  -            //   current event.  If the parser recognises and supports this
  -            //   property but is not currently parsing text, it should return
  -            //   null (this is a good way to check for availability before the
  -            //   parse begins).
  -            //
  -            if (property.equals(Constants.XML_STRING_PROPERTY)) {
  -                // REVISIT - we should probably ask xml-dev for a precise
  -                // definition of what this is actually supposed to return, and
  -                // in exactly which circumstances.
  -                throw new SAXNotSupportedException(propertyId);
  -            }
  -        }
  -
  -        //
  -        // Xerces Properties
  -        //
  -
  -        else if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
  -            String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
  -            //
  -            // http://apache.org/xml/properties/internal/symbol-table
  -            //
  -            if (property.equals(Constants.SYMBOL_TABLE_PROPERTY)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/properties/internal/error-reporter
  -            //
  -            if (property.equals(Constants.ERROR_REPORTER_PROPERTY)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/properties/internal/error-handler
  -            //
  -            if (property.equals(Constants.ERROR_HANDLER_PROPERTY)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/properties/internal/entity-manager
  -            //
  -            if (property.equals(Constants.ENTITY_MANAGER_PROPERTY)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/properties/internal/entity-resolver
  -            //
  -            if (property.equals(Constants.ENTITY_RESOLVER_PROPERTY)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/properties/internal/grammar-pool
  -            //
  -            if (property.equals(Constants.GRAMMAR_POOL_PROPERTY)) {
  -                return;
  -            }
  -            //
  -            // http://apache.org/xml/properties/internal/datatype-validator-factory
  -            //
  -            if (property.equals(Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY)) {
  -                return;
  -            }
  -        }
  -
  -        //
  -        // Not recognized
  -        //
  -
  -        throw new SAXNotRecognizedException(propertyId);
  -
  -    } // checkProperty(String)
  -
  -    // factory methods
  -
  -    /** Creates an entity manager. */
  -    protected XMLEntityManager createEntityManager() {
  -        return new XMLEntityManager();
  -    } // createEntityManager():XMLEntityManager
  -
  -    /** Creates an error reporter. */
  -    protected XMLErrorReporter createErrorReporter(Locator locator) {
  -        return new XMLErrorReporter(locator);
  -    } // createErrorReporter(Locator):XMLErrorReporter
   
   } // class XMLParser
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +759 -0    xml-xerces/java/src/org/apache/xerces/parsers/Attic/BasicParserConfiguration.java
  
  
  
  
  1.1.2.1   +290 -0    xml-xerces/java/src/org/apache/xerces/parsers/Attic/ParserConfiguration.java
  
  
  
  
  1.1.2.1   +454 -0    xml-xerces/java/src/org/apache/xerces/parsers/Attic/StandardParserConfiguration.java