1
package com.thaiopensource.xml.sax;
3
import javax.xml.parsers.SAXParserFactory;
4
import javax.xml.parsers.ParserConfigurationException;
5
import org.xml.sax.XMLReader;
6
import org.xml.sax.SAXException;
8
import com.thaiopensource.xml.sax.XMLReaderCreator;
11
* An <code>XMLReaderCreator</code> that uses JAXP 1.1 to create <code>XMLReader</code>s.
12
* An instance of this class is <em>not</em> safe for concurrent access by multiple threads.
14
* @see javax.xml.parsers.SAXParserFactory
15
* @author <a href="mailto:jjc@jclark.com">James Clark</a>
17
public class Jaxp11XMLReaderCreator implements XMLReaderCreator {
19
private final SAXParserFactory factory;
22
* Default constructor.
24
public Jaxp11XMLReaderCreator() {
25
factory = SAXParserFactory.newInstance();
26
factory.setNamespaceAware(true);
27
factory.setValidating(false);
30
public XMLReader createXMLReader() throws SAXException {
32
return factory.newSAXParser().getXMLReader();
34
catch (ParserConfigurationException e) {
35
throw new SAXException(e);