Ignore:
Timestamp:
11/24/06 14:20:40 (6 years ago)
Author:
sys
Message:

cleanup incrementalSax

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Res_Xalan/org/apache/xml/dtm/ref/DTMManagerDefault.java

    r7031 r7489  
    318318          // created a new DTM. 
    319319          addDTM(dtm, dtmPos, 0); 
    320  
    321  
    322           boolean haveXercesParser = 
    323                      (null != reader) 
    324                      && (reader.getClass() 
    325                                .getName() 
    326                                .equals("org.apache.xerces.parsers.SAXParser") ); 
    327320         
    328           if (haveXercesParser) { 
    329             incremental = true;  // No matter what.  %REVIEW% 
    330           } 
    331          
    332           // If the reader is null, but they still requested an incremental 
    333           // build, then we still want to set up the IncrementalSAXSource stuff. 
    334           if (m_incremental && incremental 
    335                /* || ((null == reader) && incremental) */) { 
    336             IncrementalSAXSource coParser=null; 
    337  
    338             if (haveXercesParser) { 
    339               // IncrementalSAXSource_Xerces to avoid threading. 
    340               try { 
    341                 coParser =(IncrementalSAXSource) 
    342                   Class.forName("org.apache.xml.dtm.ref.IncrementalSAXSource_Xerces").newInstance();   
    343               }  catch( Exception ex ) { 
    344                 ex.printStackTrace(); 
    345                 coParser=null; 
    346               } 
    347             } 
    348  
    349             if (coParser==null ) { 
    350               // Create a IncrementalSAXSource to run on the secondary thread. 
    351               if (null == reader) { 
    352                 coParser = new IncrementalSAXSource_Filter(); 
    353               } else { 
    354                 IncrementalSAXSource_Filter filter = 
    355                          new IncrementalSAXSource_Filter(); 
    356                 filter.setXMLReader(reader); 
    357                 coParser=filter; 
    358               } 
    359             } 
    360  
    361                          
    362             /************************************************************** 
    363             // EXPERIMENTAL 3/22/02 
    364             if (JKESS_XNI_EXPERIMENT && m_incremental && 
    365                   dtm instanceof XNI2DTM &&  
    366                   coParser instanceof IncrementalSAXSource_Xerces) { 
    367                 org.apache.xerces.xni.parser.XMLPullParserConfiguration xpc= 
    368                       ((IncrementalSAXSource_Xerces)coParser) 
    369                                            .getXNIParserConfiguration(); 
    370               if (xpc!=null) { 
    371                 // Bypass SAX; listen to the XNI stream 
    372                 ((XNI2DTM)dtm).setIncrementalXNISource(xpc); 
    373               } else { 
    374                   // Listen to the SAX stream (will fail, diagnostically...) 
    375                 dtm.setIncrementalSAXSource(coParser); 
    376               } 
    377             } else 
    378             ***************************************************************/ 
    379            
    380             // Have the DTM set itself up as IncrementalSAXSource's listener. 
    381             dtm.setIncrementalSAXSource(coParser); 
    382  
    383             if (null == xmlSource) { 
    384  
    385               // Then the user will construct it themselves. 
    386               return dtm; 
    387             } 
    388  
    389             if (null == reader.getErrorHandler()) { 
    390               reader.setErrorHandler(dtm); 
    391             } 
    392             reader.setDTDHandler(dtm); 
    393  
    394             try { 
    395               // Launch parsing coroutine.  Launches a second thread, 
    396               // if we're using IncrementalSAXSource.filter(). 
    397  
    398               coParser.startParse(xmlSource); 
    399             } catch (RuntimeException re) { 
    400  
    401               dtm.clearCoRoutine(); 
    402  
    403               throw re; 
    404             } catch (Exception e) { 
    405  
    406               dtm.clearCoRoutine(); 
    407  
    408               throw new org.apache.xml.utils.WrappedRuntimeException(e); 
    409             } 
    410           } else { 
    411321            if (null == reader) { 
    412  
    413322              // Then the user will construct it themselves. 
    414323              return dtm; 
     
    440349              throw new org.apache.xml.utils.WrappedRuntimeException(e); 
    441350            } 
    442           } 
    443351 
    444352          if (DUMPTREE) { 
Note: See TracChangeset for help on using the changeset viewer.