santiagopg    2003/11/17 12:01:59

  Modified:    java/src/org/apache/xalan/xsltc/trax
                        TransformerFactoryImpl.java Util.java
  Log:
  Patch for Bugzilla 24695 by Bhakti Mehta ([EMAIL PROTECTED]).
  
  Revision  Changes    Path
  1.66      +16 -3     
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java
  
  Index: TransformerFactoryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- TransformerFactoryImpl.java       31 Oct 2003 22:30:53 -0000      1.65
  +++ TransformerFactoryImpl.java       17 Nov 2003 20:01:59 -0000      1.66
  @@ -1052,8 +1052,21 @@
        }
        XMLReader result = (XMLReader) _xmlReader.get();
        if (result == null) {
  -         _xmlReader.set(
  -             result = _parserFactory.newSAXParser().getXMLReader());
  + 
  +            /*
  +              * Fix for bug 24695
  +              * According to JAXP 1.2 specification if a SAXSource
  +              * is created using a SAX InputSource the Transformer or
  +              * TransformerFactory creates a reader via the XMLReaderFactory
  +              * if setXMLReader is not used
  +              */
  +            result = XMLReaderFactory.createXMLReader();
  +            result.setFeature("http://xml.org/sax/features/namespaces";,
  +               true);
  +            
result.setFeature("http://xml.org/sax/features/namespace-prefixes";,
  +               false);
  +            _xmlReader.set(result);
  +
        }
        return result;
       }
  
  
  
  1.8       +38 -2     xml-xalan/java/src/org/apache/xalan/xsltc/trax/Util.java
  
  Index: Util.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/Util.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Util.java 21 Oct 2003 18:15:23 -0000      1.7
  +++ Util.java 17 Nov 2003 20:01:59 -0000      1.8
  @@ -75,7 +75,13 @@
   import org.apache.xalan.xsltc.compiler.util.ErrorMsg;
   
   import org.w3c.dom.Document;
  +
   import org.xml.sax.InputSource;
  +import org.xml.sax.SAXException;
  +import org.xml.sax.SAXNotRecognizedException;
  +import org.xml.sax.SAXNotSupportedException;
  +import org.xml.sax.XMLReader;
  +import org.xml.sax.helpers.XMLReaderFactory;
   
   public final class Util {
   
  @@ -110,7 +116,37 @@
                final SAXSource sax = (SAXSource)source;
                input = sax.getInputSource();
                // Pass the SAX parser to the compiler
  -             xsltc.setXMLReader(sax.getXMLReader());
  +                try {
  +                    XMLReader reader = sax.getXMLReader();
  +
  +                     /*
  +                      * Fix for bug 24695
  +                      * According to JAXP 1.2 specification if a SAXSource
  +                      * is created using a SAX InputSource the Transformer or
  +                      * TransformerFactory creates a reader via the
  +                      * XMLReaderFactory if setXMLReader is not used
  +                      */
  +
  +                    if (reader == null) {
  +                       reader= XMLReaderFactory.createXMLReader();
  +                       reader.setFeature
  +                        ("http://xml.org/sax/features/namespaces",true);
  +                       reader.setFeature
  +                        
("http://xml.org/sax/features/namespace-prefixes",false);
  +                    }
  +
  +                    xsltc.setXMLReader(reader);
  +                }catch (SAXNotRecognizedException snre ) {
  +                  throw new TransformerConfigurationException
  +                       ("SAXNotRecognizedException ",snre);
  +                }catch (SAXNotSupportedException snse ) {
  +                  throw new TransformerConfigurationException
  +                       ("SAXNotSupportedException ",snse);
  +                }catch (SAXException se ) {
  +                  throw new TransformerConfigurationException
  +                       ("SAXException ",se);
  +                }
  +
            }
            // handle  DOMSource  
            else if (source instanceof DOMSource) {
  
  
  

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

Reply via email to