javax.xml.parsers.FactoryConfigurationError
843834Sep 30 2002 — edited Oct 6 2002Hi, Everybody,
I am facing problem, Whenever I tried to read XML file I found following Error.
"javax.xml.parsers.FactoryConfigurationError: Provider for javax.xml.parsers.DocumentBuilderFactory cannot be found
at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
at Pricing.mapDoc(Pricing.java:39)
at Pricing.main(Pricing.java:84)"
My function code is as follows:
public void mapDoc()
{
Document mapDoc = null;
try {
//Create the DocumentBuilderFactory
DocumentBuilderFactory dbfactory
= DocumentBuilderFactory.newInstance();
System.out.println("Document factory--->"+ dbfactory);
//Create the DocumentBuilder
DocumentBuilder docbuilder = dbfactory.newDocumentBuilder();
//Parse the file to create the Document
mapDoc = docbuilder.parse("mapping.xml"); Element mapRoot = mapDoc.getDocumentElement();
//Retrieve the (only) data element and cast it to Element
Node dataNode = mapRoot.getElementsByTagName("data").item(0);
Element dataElement = (Element)dataNode;
String sql = dataElement.getAttribute("sql");
System.out.println(sql);
} catch (Exception e) {
System.out.println("Problem creating document: "
+e.getMessage ());
}
}
I will be thankfull, if someone helps.