org.kohsuke.rngom.xml.sax.JAXPXMLReaderCreator Maven / Gradle / Ivy
Go to download
Old JAXB Binding Compiler. Contains source code needed for binding customization files into java sources.
In other words: the *tool* to generate java classes for the given xml representation.
package org.kohsuke.rngom.xml.sax;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
/**
* {@link XMLReaderCreator} that uses JAXP to create
* {@link XMLReader}s.
*
* @author
* Kohsuke Kawaguchi ([email protected])
*/
public class JAXPXMLReaderCreator implements XMLReaderCreator {
private final SAXParserFactory spf;
public JAXPXMLReaderCreator( SAXParserFactory spf ) {
this.spf = spf;
}
/**
* Creates a {@link JAXPXMLReaderCreator} by using
* {@link SAXParserFactory#newInstance()}.
*/
public JAXPXMLReaderCreator() {
spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
}
/**
* @see org.kohsuke.rngom.xml.sax.XMLReaderCreator#createXMLReader()
*/
public XMLReader createXMLReader() throws SAXException {
try {
return spf.newSAXParser().getXMLReader();
} catch (ParserConfigurationException e) {
throw new SAXException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy