Possible Duplicate:
Make DocumentBuilder.parse ignore DTD references
Here is my sample XML
<?xml version="1.0" standalone="no"?>
<!DOCTYPE factory-requirements SYSTEM "factory.7.0.dtd">
<data name="product">
<product name="container">
<one>20 feet</one>
<two>50 feet</two>
</product>
</data>
When I try to pass this file into my Document I get an error .
java.io.FileNotFoundException: C:\Documents and Settings\johnB\workspace\project\factory.7.0.dtd (The system cannot find the file specified)
It seems that it is looking for the DTD also which I don't have. I just need to parse this file as an XML and get products. I will not be validating this XML against a DTD since I don't have a DTD and we only get this XML from our vendors.
Here is my code:
File fstream = new File("C:/Documents and Settings/johnB/workspace/project/factory_product.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(fstream);
doc.getDocumentElement().normalize();
What can I do so it ignores <!DOCTYPE factory-requirements SYSTEM "factory.7.0.dtd">
when parsing?