File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes unable to ignore DOCTYPE during while reading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "unable to ignore DOCTYPE during while reading" Watch "unable to ignore DOCTYPE during while reading" New topic

unable to ignore DOCTYPE during while reading

Dinesh nath

Joined: Dec 16, 2009
Posts: 3
I am trying to read the following xml file

using the below code

I am getting the following error

Nested exception: 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

Joined: Oct 14, 2005
Posts: 19693

Set an EntityResolver on the parser. Code this EntityResolver to return an empty InputSource when it is requested to resolve that DTD.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: unable to ignore DOCTYPE during while reading
It's not a secret anymore!