File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to ignore DOCTYPE during while reading

 
Dinesh nath
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to read the following xml file



using the below code




I am getting the following error

Nested exception:
java.io.FileNotFoundException: Y:\default\main\example\us\WORKAREA\Corporate\templatedata\picklists\time_zones\data\dcr4.5.dtd (The system cannot find the file specified)


I understand that it is trying to locate the dtd file in the same folder as the file i am trying to parse, the DOCTYPE declaration cannot be removed from xml as the same file is used by another application. I cannot place dtd file in same folder as the xml file Itself.

How can I make the parser to ignore the DOCTYPE or please guide me with an alternate approach?
 
Paul Clapham
Sheriff
Pie
Posts: 20153
23
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set an EntityResolver on the parser. Code this EntityResolver to return an empty InputSource when it is requested to resolve that DTD.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic