Problem with external DTD and JAXP

B

Bjoern Wolter

Ich try to learn xml with java.
ich have created a simple example like this

public static void main(String[] args) {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser;

try {
factory.setValidating( false );
parser = factory.newSAXParser();
System.out.println(parser.isValidating());
parser.parse(args[0], new cHandler());
....
....
....

the example is only a part and it is working - exactly it works only if
no dtd is defined in the xml.

For my project i need a non validating parser. if i open my file in the
shown example i become an file not found exception, with the message
file foo.dtd not found.

in the xml file is the declaration for an external dtd
<!DOCTYPE xyz:my-content PUBLIC "//fooo...." "foo.dtd">

how can i parse the xml without valdating it to the dtd. the
line: factory.setValidating( false ); takes no effect....

I want to use the parser who is delivered with java not any third party
tool like xerces, there i can set options to ignore external dtds.

any helps for me ??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top