1 6 package org.xml.sax.helpers; 7 8 import java.lang.ClassNotFoundException ; 9 import java.lang.IllegalAccessException ; 10 import java.lang.InstantiationException ; 11 import java.lang.SecurityException ; 12 import java.lang.ClassCastException ; 13 14 import org.xml.sax.Parser ; 15 16 17 49 public class ParserFactory { 50 51 52 55 private ParserFactory () 56 { 57 } 58 59 60 81 public static Parser makeParser () 82 throws ClassNotFoundException , 83 IllegalAccessException , 84 InstantiationException , 85 NullPointerException , 86 ClassCastException 87 { 88 String className = System.getProperty("org.xml.sax.parser"); 89 if (className == null) { 90 throw new NullPointerException ("No value for sax.parser property"); 91 } else { 92 return makeParser(className); 93 } 94 } 95 96 97 118 public static Parser makeParser (String className) 119 throws ClassNotFoundException , 120 IllegalAccessException , 121 InstantiationException , 122 ClassCastException 123 { 124 return (Parser ) NewInstance.newInstance ( 125 NewInstance.getClassLoader (), className); 126 } 127 128 } 129 130 | Popular Tags |