You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2002/01/26 00:58:38 UTC

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

elena       02/01/25 15:58:38

  Modified:    java/src/org/apache/xerces/parsers
                        BasicParserConfiguration.java
                        StandardParserConfiguration.java
  Log:
  Document handler can be changed during the parse.
  Fix related to http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5084
  
  Revision  Changes    Path
  1.8       +11 -3     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BasicParserConfiguration.java	10 Jan 2002 06:34:23 -0000	1.7
  +++ BasicParserConfiguration.java	25 Jan 2002 23:58:38 -0000	1.8
  @@ -75,6 +75,7 @@
   import org.apache.xerces.xni.parser.XMLComponent;
   import org.apache.xerces.xni.parser.XMLComponentManager;
   import org.apache.xerces.xni.parser.XMLConfigurationException;
  +import org.apache.xerces.xni.parser.XMLDocumentSource;
   import org.apache.xerces.xni.parser.XMLEntityResolver;
   import org.apache.xerces.xni.parser.XMLErrorHandler;
   import org.apache.xerces.xni.parser.XMLInputSource;
  @@ -130,7 +131,7 @@
    * @author Arnaud  Le Hors, IBM
    * @author Andy Clark, IBM
    *
  - * @version $Id: BasicParserConfiguration.java,v 1.7 2002/01/10 06:34:23 twl Exp $
  + * @version $Id: BasicParserConfiguration.java,v 1.8 2002/01/25 23:58:38 elena Exp $
    */
   public abstract class BasicParserConfiguration
       extends ParserConfigurationSettings
  @@ -204,6 +205,9 @@
       /** The DTD content model handler. */
       protected XMLDTDContentModelHandler fDTDContentModelHandler;
   
  +    /** Last component in the document pipeline */     
  +    protected XMLDocumentSource fLastComponent;
  +
       //
       // Constructors
       //
  @@ -333,12 +337,16 @@
           throws XNIException, IOException;
   
       /**
  -     * Sets the document handler to receive information about the document.
  +     * Sets the document handler on the last component in the pipeline
  +     * to receive information about the document.
        * 
  -     * @param documentHandler The document handler.
  +     * @param documentHandler   The document handler.
        */
       public void setDocumentHandler(XMLDocumentHandler documentHandler) {
           fDocumentHandler = documentHandler;
  +        if (fLastComponent != null) {
  +            fLastComponent.setDocumentHandler(fDocumentHandler);
  +        }
       } // setDocumentHandler(XMLDocumentHandler)
   
       /** Returns the registered document handler. */
  
  
  
  1.15      +5 -10     xml-xerces/java/src/org/apache/xerces/parsers/StandardParserConfiguration.java
  
  Index: StandardParserConfiguration.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/StandardParserConfiguration.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- StandardParserConfiguration.java	22 Jan 2002 16:20:10 -0000	1.14
  +++ StandardParserConfiguration.java	25 Jan 2002 23:58:38 -0000	1.15
  @@ -122,7 +122,7 @@
    * @author Arnaud  Le Hors, IBM
    * @author Andy Clark, IBM
    *
  - * @version $Id: StandardParserConfiguration.java,v 1.14 2002/01/22 16:20:10 neeraj Exp $
  + * @version $Id: StandardParserConfiguration.java,v 1.15 2002/01/25 23:58:38 elena Exp $
    */
   public class StandardParserConfiguration
       extends BasicParserConfiguration 
  @@ -617,6 +617,8 @@
               fNamespaceBinder.setDocumentHandler(fDocumentHandler);
           }
   
  +        fLastComponent = fNamespaceBinder;
  +
           // setup dtd pipeline
           if (fDTDScanner != null) {
               if (fDTDValidator != null) {
  @@ -647,16 +649,9 @@
                   }
   
               }
  +            fLastComponent = fSchemaValidator;
               fNamespaceBinder.setDocumentHandler(fSchemaValidator);
  -            fSchemaValidator.setDocumentHandler(fDocumentHandler);
  -            
  -
  -            // REVISIT: we probably should not remove schema validator from the pipeline
  -            // if schema feature is off, since user might want to have some PSVI 
  -            // of the document.
  -            // On the other hand, if user constructed a parser with the default config,
  -            // turned schema on before first parse(), and then turned it off, is it possible
  -            // that user would assume that we will remove XML Schema validator?
  +            fSchemaValidator.setDocumentHandler(fDocumentHandler);            
           } 
   
   
  
  
  

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