src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java

Print this page




  88         try {
  89             // Try to get InputSource from SAXSource input
  90             if (source instanceof SAXSource) {
  91                 final SAXSource sax = (SAXSource)source;
  92                 input = sax.getInputSource();
  93                 // Pass the SAX parser to the compiler
  94                 try {
  95                     XMLReader reader = sax.getXMLReader();
  96 
  97                      /*
  98                       * Fix for bug 24695
  99                       * According to JAXP 1.2 specification if a SAXSource
 100                       * is created using a SAX InputSource the Transformer or
 101                       * TransformerFactory creates a reader via the
 102                       * XMLReaderFactory if setXMLReader is not used
 103                       */
 104 
 105                     if (reader == null) {
 106                        try {
 107                            reader= XMLReaderFactory.createXMLReader();


 108                        } catch (Exception e ) {
 109                            try {
 110 
 111                                //Incase there is an exception thrown
 112                                // resort to JAXP
 113                                SAXParserFactory parserFactory = FactoryImpl.getSAXFactory(xsltc.useServicesMechnism());
 114                                parserFactory.setNamespaceAware(true);
 115 
 116                                if (xsltc.isSecureProcessing()) {
 117                                   try {
 118                                       parserFactory.setFeature(
 119                                           XMLConstants.FEATURE_SECURE_PROCESSING, true);
 120                                   }
 121                                   catch (org.xml.sax.SAXException se) {}
 122                                }
 123 
 124                                reader = parserFactory.newSAXParser()
 125                                      .getXMLReader();
 126 
 127 




  88         try {
  89             // Try to get InputSource from SAXSource input
  90             if (source instanceof SAXSource) {
  91                 final SAXSource sax = (SAXSource)source;
  92                 input = sax.getInputSource();
  93                 // Pass the SAX parser to the compiler
  94                 try {
  95                     XMLReader reader = sax.getXMLReader();
  96 
  97                      /*
  98                       * Fix for bug 24695
  99                       * According to JAXP 1.2 specification if a SAXSource
 100                       * is created using a SAX InputSource the Transformer or
 101                       * TransformerFactory creates a reader via the
 102                       * XMLReaderFactory if setXMLReader is not used
 103                       */
 104 
 105                     if (reader == null) {
 106                        try {
 107                            reader= XMLReaderFactory.createXMLReader();
 108                            reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, 
 109                                    xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD));
 110                        } catch (Exception e ) {
 111                            try {
 112 
 113                                //Incase there is an exception thrown
 114                                // resort to JAXP
 115                                SAXParserFactory parserFactory = FactoryImpl.getSAXFactory(xsltc.useServicesMechnism());
 116                                parserFactory.setNamespaceAware(true);
 117 
 118                                if (xsltc.isSecureProcessing()) {
 119                                   try {
 120                                       parserFactory.setFeature(
 121                                           XMLConstants.FEATURE_SECURE_PROCESSING, true);
 122                                   }
 123                                   catch (org.xml.sax.SAXException se) {}
 124                                }
 125 
 126                                reader = parserFactory.newSAXParser()
 127                                      .getXMLReader();
 128 
 129