[jdom-interest] Newbie-Props

kaan derkaan at yahoo.de
Tue Sep 4 08:24:09 PDT 2001


Hi,

i try to compile this example from the XML&Java-Book:

import java.io.File;
import java.io.IOException;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;

public class SAXTest {

    public static void main(String[] args) {
        if (args.length != 1) {
            System.out.println("Usage: SAXTest
[filename to parse]");
            return;
        }

        try {
            // Request document building without
validation
            SAXBuilder builder = new
SAXBuilder(false);
            Document doc = builder.build(new
File(args[0]));
            printDocument(doc);
        } catch (JDOMException e) {
            if (e.getRootCause() != null) {
                e.getRootCause().printStackTrace();
            }
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void printDocument(Document doc)
throws IOException {
        XMLOutputter fmt = new XMLOutputter();
        fmt.output(doc, System.out);
    }
}

but it doesn´t work. 
I get this Exception:

cannot access org.xml.sax.InputSource
file org\xml\sax\InputSource.class not found
            Document doc = builder.build(new
File(args[0]));
                                  ^

Can someone tell me what´s wrong?
i´ve put the jdom.jar in the same directory where 
this source is....

thanks,
Kaan

PS: i use the jdom-b7


__________________________________________________________________
Do You Yahoo!?
Gesendet von Yahoo! Mail - http://mail.yahoo.de



More information about the jdom-interest mailing list