jkesselm    01/05/16 14:05:48

  Modified:    java/src/org/apache/xml/dtm Tag: DTM_EXP
                        CoroutineSAXFilterTest.java
  Log:
  Filter-mode doMore(false) now runs the event stream to
  completion rather than throwing an exception. I do _not_
  like this solution -- it wastes cycles -- but we've decided it
  would be impolite to do the (almost standardized) trick of
  using an exception to stop parsing early when we aren't
  the ones who could catch it and thus know to discard it.
  
  This is made considerably uglier by our current "do you want
  another file" dialog. Cutting over to a "pure" CoroutineSAXFilter
  architecture would clean up the code considerably.
  
  Note too: It is now a Requirement that any event stream we're
  filtering end with either endDocument() or fatalError(). SAX may
  not guarantee that fatalError() will be invoked for exceptions
  thrown by the ContentHandler. If it doesn't, it will the event
  source's responsibility to catch those errors and send them to
  us -- otherwise, coroutines will be left hanging.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +4 -6      
xml-xalan/java/src/org/apache/xml/dtm/Attic/CoroutineSAXFilterTest.java
  
  Index: CoroutineSAXFilterTest.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/CoroutineSAXFilterTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- CoroutineSAXFilterTest.java       2001/05/16 00:42:11     1.1.2.1
  +++ CoroutineSAXFilterTest.java       2001/05/16 21:05:41     1.1.2.2
  @@ -2,8 +2,6 @@
   
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  -import org.xml.sax.SAXNotRecognizedException;
  -import org.xml.sax.SAXNotSupportedException;
   import org.xml.sax.ext.LexicalHandler;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.Locator;
  @@ -56,7 +54,7 @@
       // Note that this is a global -- sloppy connection to the thread.
       filter=new CoroutineSAXParser(co, appCoroutineID);
   
  -    // Convenience function...
  +    // Convenience function... Set handlers
       filter.setXMLReader(theSAXParser);
       
       // Use a serializer as our sample output
  @@ -115,14 +113,14 @@
        (result instanceof Boolean && ((Boolean)result)==Boolean.TRUE);
        result = filter.doMore(more, appCoroutineID))
         {
  -     System.out.println("\nSome parsing successful, trying more.\n");
  -     
        // Special test: Terminate parsing early.
        if(TEST_EARLY_STOP)
          {
  +         System.out.println("\nSome parsing successful, trying to stop.\n");
            more=false;
          }
  -     
  +     else
  +       System.out.println("\nSome parsing successful, trying more.\n");
         }
       
       if (result instanceof Boolean && ((Boolean)result)==Boolean.FALSE)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to