1

I've an xml document that has the following

<!DOCTYPE TRACE PUBLIC "trace.dtd" "trace.dtd">

after the first line

<?xml version="1.0" encoding="UTF-8"?>

When I parse it using SAX xml parser, I get the following error...

at javax.xml.parsers.SAXParser.parse(Unknown Source)
java.io.FileNotFoundException: F:\<BLAH>\trace.dtd (The system cannot find the file specified)

Any ideas how to bypass this tag in order to parse the xml successfully?

4
  • The msg si clear : java.io.FileNotFoundException: F:\<BLAH>\trace.dtd (The system cannot find the file specified). You specified bad path value. It didn't find the file you want to parse Commented Mar 26, 2017 at 13:04
  • nope, sir, when i remove that tag from the file, it reads the file ;) so the problem is with that tag. Thanks for answering Commented Mar 26, 2017 at 13:23
  • I agree with @David.BC. It is a clear error message. If you want to validate your assumption run the code on two different files, one with the tag and one without (Do not edit trace.dtd but make an edited copy of it) Commented Mar 26, 2017 at 14:40
  • Same thing, i just checked. It's due to trace.dtd tag at the beginning. Thanks Commented Mar 27, 2017 at 7:51

1 Answer 1

1

Well according to this

SAXParser throws FileNotFoundException despite not being given a file to parse

it worked just fine

factory.setValidating(false);
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.