Problems with SAX parser in Java (SAX2 driver class javax.xml.parsers.SAXParser found but cannot be

Discussion in 'Java' started by Per Magnus L?vold, Nov 16, 2004.

  1. Hi!
    I am new to XML parsing, and I'm trying to parse an XML file which is
    passed as a BufferedReader object.
    I have followed the steps described in a Javaworld article
    (http://www.javaworld.com/javaworld/jw-08-2000/jw-0804-sax.html) which
    seems quite simple. I've also downloaded the latest Web Services
    Developer Pack, installed it, and added the jar-file to the classpath
    in JDeveloper.

    After programming the parser class, I get an error message which I
    can't figure out of:
    "Unexpected error: SAX2 driver class javax.xml.parsers.SAXParser found
    but cannot be loaded"

    Why can't it be loaded? Any ideas?

    Here is a sample of my code:

    /*
    * this is the class that calls the XML parser (myXMLParser)
    * I beleive the error must lie here somewhere, or perhaps in the
    configuration?
    */
    myXMLParser test = new myXMLParser();
    String parserclass =
    System.getProperty("org.xml.sax.driver","javax.xml.parsers.SAXParser");
    /*
    * I beleive the error comes on this next line. 'parserclass' is
    * identified as "javax.xml.parsers.SAXParser", which is found but
    cannot
    * be loaded? What could be wrong? It is added to the classpath.
    */
    XMLReader xr = XMLReaderFactory.createXMLReader(parserclass);
    xr.setContentHandler(test);
    // 'br' (below) is the BufferedReader object of an XML file
    xr.parse(new InputSource(br));

    Regards, PML
    Per Magnus L?vold, Nov 16, 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. Gibakou

    javax.xml.Parsers location

    Gibakou, Aug 16, 2004, in forum: Java
    Replies:
    4
    Views:
    912
    gizzy truong
    Nov 23, 2004
  2. Replies:
    1
    Views:
    741
    Esmond Pitt
    Mar 27, 2005
  3. Replies:
    3
    Views:
    576
  4. Thomas Guettler

    xml.parsers.expat vs. xml.sax

    Thomas Guettler, Apr 27, 2004, in forum: Python
    Replies:
    2
    Views:
    894
    Martijn Faassen
    Apr 27, 2004
  5. Erik Wasser
    Replies:
    5
    Views:
    450
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page