1 28 29 package net.n3.nanoxml; 30 31 37 public class XMLParserFactory 38 { 39 40 43 public static final String DEFAULT_CLASS = "net.n3.nanoxml.StdXMLParser"; 44 45 48 public static final String CLASS_KEY = "net.n3.nanoxml.XMLParser"; 49 50 63 public static IXMLParser createDefaultXMLParser() throws ClassNotFoundException , 64 InstantiationException , IllegalAccessException 65 { 66 String className = System.getProperty(XMLParserFactory.CLASS_KEY, 67 XMLParserFactory.DEFAULT_CLASS); 68 return XMLParserFactory.createXMLParser(className, new StdXMLBuilder()); 69 } 70 71 85 public static IXMLParser createDefaultXMLParser(IXMLBuilder builder) 86 throws ClassNotFoundException , InstantiationException , IllegalAccessException 87 { 88 String className = System.getProperty(XMLParserFactory.CLASS_KEY, 89 XMLParserFactory.DEFAULT_CLASS); 90 return XMLParserFactory.createXMLParser(className, builder); 91 } 92 93 105 public static IXMLParser createXMLParser(String className, IXMLBuilder builder) 106 throws ClassNotFoundException , InstantiationException , IllegalAccessException 107 { 108 Class cls = Class.forName(className); 109 IXMLParser parser = (IXMLParser) cls.newInstance(); 110 parser.setBuilder(builder); 111 parser.setValidator(new NonValidator()); 112 return parser; 113 } 114 115 } 116 | Popular Tags |