#46 Error on SAXParserFactory.newInstance() in WinForm App

open
nobody
None
5
2008-08-29
2008-08-29
Anonymous
No

When you call com.lowagie.text.xml.XmlParser (XmlParser.java , v 1.18 2006/09/14) in a WinForm .Net application, you receive the exception : "Provider for javax.xml.parsers.SAXParserFactory cannot be found".

I change the code of the constructor for XmlParser() like this :

Before the code was :
parser = SAXParserFactory.newInstance().newSAXParser();

I change to :
public XmlParser() {
try {
//ORIG : parser = SAXParserFactory.newInstance().newSAXParser();

org.apache.crimson.jaxp.SAXParserFactoryImpl saxParserFactoryImpl = new org.apache.crimson.jaxp.SAXParserFactoryImpl();
parser = saxParserFactoryImpl.newSAXParser();
}
catch(ParserConfigurationException pce) {
throw new ExceptionConverter(pce);
}
catch (Exception se)
{
throw new ExceptionConverter(se);
}
}

Discussion


Log in to post a comment.