Problem with java XML Parsing - FactoryConfigurationError: Provider not found
I have a java applet that parses a string of xml. However, running the following code:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document d = db.parse(xml);
Generates the following error:
javax.xml.parsers.FactoryConfigurationError: Provider <HTML> not found
Some forums I've checked prior to posting indicated that I need to add 2 jar files - xercesImpl.jar and xmlParserAPIs.jar - to my JRE_HOME/lib/ext directory. However, I don't think this is the problem because this applet is currently hosted on 2 different webserv开发者_如何学编程ers and one functions perfectly while the other fails. I looked, and neither have those jars in the jre/lib/ext directory.
Any help is greatly appreciated.
Just out of curiosity, I added xercesImpl to the applet archive on the webserver that was screwing up, and things work peachy king. I have no idea why it is functioning in the other environment without this jar (maybe it's there and I just didn't see it).
精彩评论