1 package net.sf.tomp.xtcl.source;
2
3 import net.sf.tomp.xml.sax.ParametrizedXMLReader;
4
5 import org.xml.sax.InputSource;
6 import org.xml.sax.XMLReader;
7
8 import javax.xml.transform.sax.SAXSource;
9
10 /***
11 * DOCUMENT ME!
12 *
13 * @author tomp
14 */
15 public class XTSourceFactoryImpl implements XTSourceFactory {
16 /***
17 * DOCUMENT ME!
18 *
19 * @param className DOCUMENT ME!
20 * @param is DOCUMENT ME!
21 * @return DOCUMENT ME!
22 * @throws ClassNotFoundException DOCUMENT ME!
23 * @throws InstantiationException DOCUMENT ME!
24 * @throws IllegalAccessException DOCUMENT ME!
25 */
26 public SAXSource newSAXSource(String className, InputSource is)
27 throws ClassNotFoundException, InstantiationException,
28 IllegalAccessException {
29 Class readerClass = Class.forName(className);
30 XMLReader f = (XMLReader) readerClass.newInstance();
31
32 if (f instanceof ParametrizedXMLReader) {
33 return new XTSAXSource((ParametrizedXMLReader) f, is);
34 } else {
35 return new SAXSource(f, is);
36 }
37 }
38 }
39
40
41
42
43
44
45
46
47
48
49