aspose file tools*
The moose likes XML and Related Technologies and the fly likes parsing xml file with dtd Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "parsing xml file with dtd" Watch "parsing xml file with dtd" New topic
Author

parsing xml file with dtd

Mary Connolly
Greenhorn

Joined: Mar 04, 2004
Posts: 7
I have an external dtd for a xml file. When the xml file is viewed there are no errors it seems to work okay with the dtd. However, when I go to parse the xml file using dom I am getting a SAX exception. If I do not reference the dtd in the xml file the parsing completes sucessfully. Does anyone know what I am doing wrong??? thanx
public class Diagnose
{ public String getNormValue(String sBloodGroup,
String sBloodTest, String sAgeGroup)
{ DocumentBuilderFactory dbf = null;
DocumentBuilder db = null;
Document doc = null;
try { File NormsFile = new File
("c:\\project\\BloodResults\\blood_norms.xml");
dbf = DocumentBuilderFactory.newInstance();
db = dbf.newDocumentBuilder();
dbf.setIgnoringComments(true); // We went to ignore comments
//dbf.setValidating(true); // validate DTD
doc = db.parse(NormsFile);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: parsing xml file with dtd
 
Similar Threads
Documet object is returned null
Validating xml against dtd
Xinclude, read 2 xml files
not able to create XML through DOM...
question abt validation