1 Clazz.declarePackage ("org.xml.sax.helpers");
\r
2 Clazz.load (null, "org.xml.sax.helpers.XMLReaderFactory", ["java.io.BufferedReader", "$.InputStreamReader", "java.lang.ClassLoader", "org.xml.sax.SAXException", "org.xml.sax.helpers.NewInstance", "$.ParserAdapter", "$.ParserFactory"], function () {
\r
3 c$ = Clazz.declareType (org.xml.sax.helpers, "XMLReaderFactory");
\r
4 c$.createXMLReader = Clazz.defineMethod (c$, "createXMLReader",
\r
6 var className = null;
\r
7 var loader = org.xml.sax.helpers.NewInstance.getClassLoader ();
\r
9 className = System.getProperty ("org.xml.sax.driver");
\r
11 if (Clazz.exceptionOf (e, RuntimeException)) {
\r
16 if (className == null) {
\r
18 var service = "META-INF/services/org.xml.sax.driver";
\r
21 if (loader == null) $in = ClassLoader.getSystemResourceAsStream (service);
\r
22 else $in = loader.getResourceAsStream (service);
\r
24 reader = new java.io.BufferedReader ( new java.io.InputStreamReader ($in, "UTF8"));
\r
25 className = reader.readLine ();
\r
28 if (Clazz.exceptionOf (e, Exception)) {
\r
33 }if (className == null) {
\r
34 }if (className != null) return org.xml.sax.helpers.XMLReaderFactory.loadClass (loader, className);
\r
36 return new org.xml.sax.helpers.ParserAdapter (org.xml.sax.helpers.ParserFactory.makeParser ());
\r
38 if (Clazz.exceptionOf (e, Exception)) {
\r
39 throw new org.xml.sax.SAXException ("Can\'t create default XMLReader; is system property org.xml.sax.driver set?");
\r
45 c$.createXMLReader = Clazz.defineMethod (c$, "createXMLReader",
\r
46 function (className) {
\r
47 return org.xml.sax.helpers.XMLReaderFactory.loadClass (org.xml.sax.helpers.NewInstance.getClassLoader (), className);
\r
49 c$.loadClass = Clazz.defineMethod (c$, "loadClass",
\r
50 function (loader, className) {
\r
52 return org.xml.sax.helpers.NewInstance.newInstance (loader, className);
\r
54 if (Clazz.exceptionOf (e$$, ClassNotFoundException)) {
\r
57 throw new org.xml.sax.SAXException ("SAX2 driver class " + className + " not found", e1);
\r
59 } else if (Clazz.exceptionOf (e$$, IllegalAccessException)) {
\r
62 throw new org.xml.sax.SAXException ("SAX2 driver class " + className + " found but cannot be loaded", e2);
\r
64 } else if (Clazz.exceptionOf (e$$, InstantiationException)) {
\r
67 throw new org.xml.sax.SAXException ("SAX2 driver class " + className + " loaded but cannot be instantiated (no empty public constructor?)", e3);
\r
69 } else if (Clazz.exceptionOf (e$$, ClassCastException)) {
\r
72 throw new org.xml.sax.SAXException ("SAX2 driver class " + className + " does not implement XMLReader", e4);
\r
78 }, "ClassLoader,~S");
\r
79 Clazz.defineStatics (c$,
\r
80 "property", "org.xml.sax.driver");
\r