1 18 19 20 package org.apache.tomcat.util.digester; 21 22 import java.util.Properties ; 23 24 import javax.xml.parsers.ParserConfigurationException ; 25 import javax.xml.parsers.SAXParser ; 26 27 import org.xml.sax.SAXException ; 28 import org.xml.sax.SAXNotRecognizedException ; 29 import org.xml.sax.SAXNotSupportedException ; 30 31 38 public class ParserFeatureSetterFactory{ 39 40 43 private static boolean isXercesUsed; 44 45 static { 46 try{ 47 Class versionClass = 49 Class.forName("org.apache.xerces.impl.Version"); 50 isXercesUsed = true; 51 } catch (Exception ex){ 52 isXercesUsed = false; 53 } 54 } 55 56 62 public static SAXParser newSAXParser(Properties properties) 63 throws ParserConfigurationException , 64 SAXException , 65 SAXNotRecognizedException , 66 SAXNotSupportedException { 67 68 if (isXercesUsed){ 69 return XercesParser.newSAXParser(properties); 70 } else { 71 return GenericParser.newSAXParser(properties); 72 } 73 } 74 75 } | Popular Tags |