mmidy       00/12/18 09:27:29

  Modified:    java/src/org/apache/xalan/processor ProcessorInclude.java
                        TransformerFactoryImpl.java
               java/src/org/apache/xalan/transformer TransformerImpl.java
  Log:
  Fix code so that it uses the XMLReader provided when one is provided
  
  Revision  Changes    Path
  1.15      +17 -15    
xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java
  
  Index: ProcessorInclude.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ProcessorInclude.java     2000/11/30 09:57:30     1.14
  +++ ProcessorInclude.java     2000/12/18 17:27:23     1.15
  @@ -262,22 +262,24 @@
         
         InputSource inputSource = SAXSource.sourceToInputSource(source);
   
  -      // Use JAXP1.1 ( if possible )
  -      try {
  -       javax.xml.parsers.SAXParserFactory factory=
  -           javax.xml.parsers.SAXParserFactory.newInstance();
  -       factory.setNamespaceAware( true );
  -       javax.xml.parsers.SAXParser jaxpParser=
  -           factory.newSAXParser();
  -       reader=jaxpParser.getXMLReader();
  -       
  -      } catch( javax.xml.parsers.ParserConfigurationException ex ) {
  -       throw new org.xml.sax.SAXException( ex );
  -      } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) {
  -       throw new org.xml.sax.SAXException( ex1.toString() );
  -      } catch( NoSuchMethodError ex2 ) {
  +      if (null == reader)
  +      {  
  +        // Use JAXP1.1 ( if possible )
  +        try {
  +          javax.xml.parsers.SAXParserFactory factory=
  +                                                     
javax.xml.parsers.SAXParserFactory.newInstance();
  +          factory.setNamespaceAware( true );
  +          javax.xml.parsers.SAXParser jaxpParser=
  +                                                 factory.newSAXParser();
  +          reader=jaxpParser.getXMLReader();
  +          
  +        } catch( javax.xml.parsers.ParserConfigurationException ex ) {
  +          throw new org.xml.sax.SAXException( ex );
  +        } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) {
  +            throw new org.xml.sax.SAXException( ex1.toString() );
  +        } catch( NoSuchMethodError ex2 ) {
  +        }
         }
  -      
         if (null == reader)
           reader = XMLReaderFactory.createXMLReader();
   
  
  
  
  1.16      +21 -18    
xml-xalan/java/src/org/apache/xalan/processor/TransformerFactoryImpl.java
  
  Index: TransformerFactoryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/TransformerFactoryImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TransformerFactoryImpl.java       2000/12/14 22:45:42     1.15
  +++ TransformerFactoryImpl.java       2000/12/18 17:27:23     1.16
  @@ -689,28 +689,31 @@
         if (source instanceof SAXSource)
           reader = ((SAXSource) source).getXMLReader();
   
  -      // Use JAXP1.1 ( if possible )
  -      try
  -      {
  -        javax.xml.parsers.SAXParserFactory factory =
  -          javax.xml.parsers.SAXParserFactory.newInstance();
  +      if (null == reader)
  +      {  
  +        // Use JAXP1.1 ( if possible )
  +        try
  +        {
  +          javax.xml.parsers.SAXParserFactory factory =
  +                                                      
javax.xml.parsers.SAXParserFactory.newInstance();
   
  -        factory.setNamespaceAware(true);
  +          factory.setNamespaceAware(true);
   
  -        javax.xml.parsers.SAXParser jaxpParser = factory.newSAXParser();
  +          javax.xml.parsers.SAXParser jaxpParser = factory.newSAXParser();
   
  -        reader = jaxpParser.getXMLReader();
  +          reader = jaxpParser.getXMLReader();
  +        }
  +        catch (javax.xml.parsers.ParserConfigurationException ex)
  +        {
  +          throw new org.xml.sax.SAXException(ex);
  +        }
  +        catch (javax.xml.parsers.FactoryConfigurationError ex1)
  +        {
  +          throw new org.xml.sax.SAXException(ex1.toString());
  +        }
  +        catch (NoSuchMethodError ex2){}
         }
  -      catch (javax.xml.parsers.ParserConfigurationException ex)
  -      {
  -        throw new org.xml.sax.SAXException(ex);
  -      }
  -      catch (javax.xml.parsers.FactoryConfigurationError ex1)
  -      {
  -        throw new org.xml.sax.SAXException(ex1.toString());
  -      }
  -      catch (NoSuchMethodError ex2){}
  -
  +      
         if (null == reader)
           reader = XMLReaderFactory.createXMLReader();
   
  
  
  
  1.64      +23 -18    
xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- TransformerImpl.java      2000/12/15 17:14:34     1.63
  +++ TransformerImpl.java      2000/12/18 17:27:27     1.64
  @@ -481,24 +481,26 @@
         if(source instanceof SAXSource)
           reader = ((SAXSource)source).getXMLReader();
   
  -      // Use JAXP1.1 ( if possible )
  -      try {
  +      if (null == reader)
  +      {
  +      // Use JAXP1.1 ( if possible )      
  +        try {
             javax.xml.parsers.SAXParserFactory factory=
  -              javax.xml.parsers.SAXParserFactory.newInstance();
  +                                                     
javax.xml.parsers.SAXParserFactory.newInstance();
             factory.setNamespaceAware( true );
             javax.xml.parsers.SAXParser jaxpParser=
  -              factory.newSAXParser();
  +                                                 factory.newSAXParser();
             reader=jaxpParser.getXMLReader();
             
  -      } catch( javax.xml.parsers.ParserConfigurationException ex ) {
  +        } catch( javax.xml.parsers.ParserConfigurationException ex ) {
             throw new org.xml.sax.SAXException( ex );
  -      } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) {
  -          throw new org.xml.sax.SAXException( ex1.toString() );
  -      } catch( NoSuchMethodError ex2 ) {
  +        } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) {
  +            throw new org.xml.sax.SAXException( ex1.toString() );
  +        } catch( NoSuchMethodError ex2 ) {
  +        }
         }
  -
         if (null == reader)
  -      {
  +      {        
           reader = XMLReaderFactory.createXMLReader();
         }
   
  @@ -795,20 +797,23 @@
         if(source instanceof SAXSource)
           reader = ((SAXSource)source).getXMLReader();
   
  -      // Use JAXP1.1 ( if possible )
  -      try {
  +      if (null == reader)
  +      {
  +        // Use JAXP1.1 ( if possible )
  +        try {
             javax.xml.parsers.SAXParserFactory factory=
  -              javax.xml.parsers.SAXParserFactory.newInstance();
  +                                                     
javax.xml.parsers.SAXParserFactory.newInstance();
             factory.setNamespaceAware( true );
             javax.xml.parsers.SAXParser jaxpParser=
  -              factory.newSAXParser();
  +                                                 factory.newSAXParser();
             reader=jaxpParser.getXMLReader();
             
  -      } catch( javax.xml.parsers.ParserConfigurationException ex ) {
  +        } catch( javax.xml.parsers.ParserConfigurationException ex ) {
             throw new org.xml.sax.SAXException( ex );
  -      } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) {
  -          throw new org.xml.sax.SAXException( ex1.toString() );
  -      } catch( NoSuchMethodError ex2 ) {
  +        } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) {
  +            throw new org.xml.sax.SAXException( ex1.toString() );
  +        } catch( NoSuchMethodError ex2 ) {
  +        }
         }
   
         if (null == reader)
  
  
  

Reply via email to