You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jk...@apache.org on 2002/02/06 18:46:45 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM.java

jkesselm    02/02/06 09:46:45

  Modified:    java/src/org/apache/xml/dtm/ref DTMManagerDefault.java
                        IncrementalSAXSource.java
                        IncrementalSAXSource_Filter.java
                        IncrementalSAXSource_Xerces.java
               java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM.java
  Log:
  Bug 4244: Incremental wasn't setting up correctly for the
  DTDHandler stream. It never occurred to me that XSLT would
  ever have a use for unparsed entities...
  
  Revision  Changes    Path
  1.35      +3 -3      xml-xalan/java/src/org/apache/xml/dtm/ref/DTMManagerDefault.java
  
  Index: DTMManagerDefault.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMManagerDefault.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- DTMManagerDefault.java	31 Jan 2002 16:08:23 -0000	1.34
  +++ DTMManagerDefault.java	6 Feb 2002 17:46:45 -0000	1.35
  @@ -396,8 +396,8 @@
             }
   
             if(null == reader.getErrorHandler())
  -            reader.setDTDHandler(dtm);
  -          reader.setErrorHandler(dtm);
  +            reader.setErrorHandler(dtm);
  +          reader.setDTDHandler(dtm);
   
             try
             {
  @@ -434,7 +434,7 @@
             reader.setContentHandler(dtm);
             reader.setDTDHandler(dtm);
             if(null == reader.getErrorHandler())
  -            reader.setDTDHandler(dtm);
  +            reader.setErrorHandler(dtm);
   
             try
             {
  
  
  
  1.3       +4 -0      xml-xalan/java/src/org/apache/xml/dtm/ref/IncrementalSAXSource.java
  
  Index: IncrementalSAXSource.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/IncrementalSAXSource.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IncrementalSAXSource.java	20 Jul 2001 18:48:11 -0000	1.2
  +++ IncrementalSAXSource.java	6 Feb 2002 17:46:45 -0000	1.3
  @@ -86,6 +86,10 @@
      */
     public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler);
   
  +  /**  Register a SAX-style DTD handler for us to output to
  +   */
  +  public void setDTDHandler(org.xml.sax.DTDHandler handler);
  +
     // ------------------------------------------------------------------
     // Command Input API
     // ------------------------------------------------------------------
  
  
  
  1.7       +23 -1     xml-xalan/java/src/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java
  
  Index: IncrementalSAXSource_Filter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- IncrementalSAXSource_Filter.java	1 Oct 2001 13:03:38 -0000	1.6
  +++ IncrementalSAXSource_Filter.java	6 Feb 2002 17:46:45 -0000	1.7
  @@ -64,6 +64,7 @@
   import org.xml.sax.SAXNotSupportedException;
   import org.xml.sax.ext.LexicalHandler;
   import org.xml.sax.ContentHandler;
  +import org.xml.sax.DTDHandler;
   import org.xml.sax.ErrorHandler;
   import org.xml.sax.Locator;
   import org.xml.sax.Attributes;
  @@ -99,7 +100,7 @@
    * false.
    * */
   public class IncrementalSAXSource_Filter
  -implements IncrementalSAXSource, ContentHandler, LexicalHandler, ErrorHandler, Runnable
  +implements IncrementalSAXSource, ContentHandler, DTDHandler, LexicalHandler, ErrorHandler, Runnable
   {
     boolean DEBUG=false; //Internal status report
   
  @@ -112,6 +113,7 @@
   
     private ContentHandler clientContentHandler=null; // %REVIEW% support multiple?
     private LexicalHandler clientLexicalHandler=null; // %REVIEW% support multiple?
  +  private DTDHandler clientDTDHandler=null; // %REVIEW% support multiple?
     private ErrorHandler clientErrorHandler=null; // %REVIEW% support multiple?
     private int eventcounter;
     private int frequency=5;
  @@ -176,6 +178,7 @@
     {
       fXMLReader=eventsource;
       eventsource.setContentHandler(this);
  +    eventsource.setDTDHandler(this);
       eventsource.setErrorHandler(this); // to report fatal errors in filtering mode
   
       // Not supported by all SAX2 filters:
  @@ -203,6 +206,11 @@
     {
       clientContentHandler=handler;
     }
  +  // Register a DTD handler for us to output to
  +  public void setDTDHandler(DTDHandler handler)
  +  {
  +    clientDTDHandler=handler;
  +  }
     // Register a lexical handler for us to output to
     // Not all filters support this...
     // ??? Should we register directly on the filter?
  @@ -425,6 +433,20 @@
         clientLexicalHandler.startEntity(name);
     }
   
  +  //
  +  // DTDHandler support.
  +  
  +  public void notationDecl(String a, String b, String c) throws SAXException
  +  {
  +  	if(null!=clientDTDHandler)
  +	  	clientDTDHandler.notationDecl(a,b,c);
  +  }
  +  public void unparsedEntityDecl(String a, String b, String c, String d)  throws SAXException
  +  {
  +  	if(null!=clientDTDHandler)
  +	  	clientDTDHandler.unparsedEntityDecl(a,b,c,d);
  +  }
  +  
     //
     // ErrorHandler support.
     //
  
  
  
  1.8       +9 -2      xml-xalan/java/src/org/apache/xml/dtm/ref/IncrementalSAXSource_Xerces.java
  
  Index: IncrementalSAXSource_Xerces.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/IncrementalSAXSource_Xerces.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- IncrementalSAXSource_Xerces.java	13 Dec 2001 15:31:35 -0000	1.7
  +++ IncrementalSAXSource_Xerces.java	6 Feb 2002 17:46:45 -0000	1.8
  @@ -255,8 +255,7 @@
       ((XMLReader)fIncrementalParser).setContentHandler(handler);
     }
   
  -  // Note name, needed to dodge the inherited Xerces setLexicalHandler
  -  // which isn't public.
  +  // Register handler directly with the incremental parser
     public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
     {
       // Not supported by all SAX2 parsers but should work in Xerces:
  @@ -277,6 +276,14 @@
       }
     }
     
  +  // Register handler directly with the incremental parser
  +  public void setDTDHandler(org.xml.sax.DTDHandler handler)
  +  {
  +    // Typecast required in Xerces2; SAXParser doesn't inheret XMLReader
  +    // %OPT% Cast at asignment?
  +    ((XMLReader)fIncrementalParser).setDTDHandler(handler);
  +  }
  +
     //================================================================
     /** startParse() is a simple API which tells the IncrementalSAXSource
      * to begin reading a document.
  
  
  
  1.27      +1 -1      xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
  
  Index: SAX2DTM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- SAX2DTM.java	31 Jan 2002 16:08:24 -0000	1.26
  +++ SAX2DTM.java	6 Feb 2002 17:46:45 -0000	1.27
  @@ -360,11 +360,11 @@
       // Establish SAX-stream link so we can receive the requested data
       incrementalSAXSource.setContentHandler(this);
       incrementalSAXSource.setLexicalHandler(this);
  +    incrementalSAXSource.setDTDHandler(this);
   
       // Are the following really needed? incrementalSAXSource doesn't yet
       // support them, and they're mostly no-ops here...
       //incrementalSAXSource.setErrorHandler(this);
  -    //incrementalSAXSource.setDTDHandler(this);
       //incrementalSAXSource.setDeclHandler(this);
     }
   
  
  
  

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