Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

parsing xml file with dtd

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
 
There's a hole in the bucket, dear Liza, dear Liza, a hole in the bucket, dear liza, a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!