Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Ignore DOCTYPE when parsing an XML file

843834Aug 19 2003 — edited Aug 19 2003
Hi,
I have a problem when parsing an XML file. The file contains:
<!DOCTYPE ... SYSTEM 'file:///..../export.dtd'>

As the XML file originates from another server I don't have the DTD file on my filesystem. Therefore, when I parse the file using SAXP I receive an exception saying "java.io.FileNotFoundException: .....".
Have tried setValidating as below, but without any success:
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(false);

It seems as if the parser tries to find the DTD-file regardless of what setValidating is set to.

So, how do I prevent the parser to look for the DTD-file?

Thanks in advance for your help,
Christina
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 16 2003
Added on Aug 19 2003
1 comment
419 views