Problem with external DTD and JAXP

Discussion in 'Java' started by Bjoern Wolter, Feb 11, 2004.

  1. 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 ??
    Bjoern Wolter, Feb 11, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kent Lichty
    Replies:
    0
    Views:
    4,294
    Kent Lichty
    Jul 2, 2004
  2. Joseph Tilian
    Replies:
    0
    Views:
    339
    Joseph Tilian
    Dec 21, 2004
  3. Ronald Fischer
    Replies:
    4
    Views:
    1,742
    Ronald Fischer
    Mar 17, 2005
  4. bugbear
    Replies:
    0
    Views:
    997
    bugbear
    Aug 28, 2003
  5. test
    Replies:
    2
    Views:
    1,995
    Oliver Wong
    Jul 28, 2006
Loading...

Share This Page