src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java

Print this page




 119                     // XMLReaderFactory if setXMLReader is not used
 120                     reader = XMLReaderFactory.createXMLReader();
 121 
 122                 } catch (Exception e) {
 123                    try {
 124                         // If unable to create an instance, let's try to use
 125                         // the XMLReader from JAXP
 126                         if (m_parserFactory == null) {
 127                             m_parserFactory = FactoryImpl.getSAXFactory(m_useServicesMechanism);
 128                             m_parserFactory.setNamespaceAware(true);
 129                         }
 130 
 131                         reader = m_parserFactory.newSAXParser().getXMLReader();
 132                    } catch (ParserConfigurationException pce) {
 133                        throw pce;   // pass along pce
 134                    }
 135                 }
 136                 try {
 137                     reader.setFeature(NAMESPACES_FEATURE, true);
 138                     reader.setFeature(NAMESPACE_PREFIXES_FEATURE, false);
 139                     reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
 140                 } catch (SAXException se) {
 141                     // Try to carry on if we've got a parser that
 142                     // doesn't know about namespace prefixes.
 143                 }






 144             } catch (ParserConfigurationException ex) {
 145                 throw new SAXException(ex);
 146             } catch (FactoryConfigurationError ex1) {
 147                 throw new SAXException(ex1.toString());
 148             } catch (NoSuchMethodError ex2) {
 149             } catch (AbstractMethodError ame) {
 150             }
 151 
 152             // Cache the XMLReader if this is the first time we've created
 153             // a reader for this thread.
 154             if (!threadHasReader) {
 155                 m_readers.set(reader);
 156                 m_inUse.put(reader, Boolean.TRUE);
 157             }
 158         }
 159 
 160         return reader;
 161     }
 162 
 163     /**




 119                     // XMLReaderFactory if setXMLReader is not used
 120                     reader = XMLReaderFactory.createXMLReader();
 121 
 122                 } catch (Exception e) {
 123                    try {
 124                         // If unable to create an instance, let's try to use
 125                         // the XMLReader from JAXP
 126                         if (m_parserFactory == null) {
 127                             m_parserFactory = FactoryImpl.getSAXFactory(m_useServicesMechanism);
 128                             m_parserFactory.setNamespaceAware(true);
 129                         }
 130 
 131                         reader = m_parserFactory.newSAXParser().getXMLReader();
 132                    } catch (ParserConfigurationException pce) {
 133                        throw pce;   // pass along pce
 134                    }
 135                 }
 136                 try {
 137                     reader.setFeature(NAMESPACES_FEATURE, true);
 138                     reader.setFeature(NAMESPACE_PREFIXES_FEATURE, false);

 139                 } catch (SAXException se) {
 140                     // Try to carry on if we've got a parser that
 141                     // doesn't know about namespace prefixes.
 142                 }
 143                 try {
 144                     reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
 145                 } catch (SAXException se) {
 146                     System.err.println("Warning:  " + reader.getClass().getName() + ": " 
 147                                 + se.getMessage());
 148                 }
 149             } catch (ParserConfigurationException ex) {
 150                 throw new SAXException(ex);
 151             } catch (FactoryConfigurationError ex1) {
 152                 throw new SAXException(ex1.toString());
 153             } catch (NoSuchMethodError ex2) {
 154             } catch (AbstractMethodError ame) {
 155             }
 156 
 157             // Cache the XMLReader if this is the first time we've created
 158             // a reader for this thread.
 159             if (!threadHasReader) {
 160                 m_readers.set(reader);
 161                 m_inUse.put(reader, Boolean.TRUE);
 162             }
 163         }
 164 
 165         return reader;
 166     }
 167 
 168     /**