Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Problem with external DTD and JAXP

Thread Tools

Problem with external DTD and JAXP

Bjoern Wolter
Posts: n/a
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();
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 ??
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML file from one DTD to another DTD test Java 2 07-28-2006 08:48 PM
How to specify DTD to DTD.getDTD for DocumentParser? Ronald Fischer Java 4 03-17-2005 09:37 AM
Removing the dtd name when using print(...) on the dtd generated class Joseph Tilian Java 0 12-21-2004 02:58 PM
Including a dtd into another dtd... possible? Asfand Yar Qazi XML 1 09-19-2003 12:10 PM
parsing XML to DOM, validating against a local DTD, using Xerces under JAXP? bugbear XML 0 08-28-2003 09:22 AM