找不到SAX驱动程序

时间:2015-12-05 22:49:41

标签: java sax

尝试编写简单的客户端服务器应用程序。问题是无法找到SAX驱动程序。我是Java新手,所以不知道如何解决这个问题。

import helma.xmlrpc.WebServer;
import helma.xmlrpc.XmlRpc;

public class JavaServer {

    public Integer sum(int x, int y){
        return new Integer(x+y);
    }

    public static void main (String [] args){
        try {
            XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser");

        } catch (ClassNotFoundException e) {
            System.out.println("Could not locate SAX Driver");
        }

        try {

            System.out.println("Attempting to start XML-RPC Server...");

            WebServer server = new WebServer(8080);
            server.addHandler("sample", new JavaServer());
            server.start();

            System.out.println("Started successfully.");
            System.out.println("Accepting requests. (Halt program to stop.)");

        } catch (Exception exception){
            System.err.println("JavaServer: " + exception);
        }


    }
}

1 个答案:

答案 0 :(得分:0)

  1. 点击here并下载xerces-2_6_2.jar,用于解析XML文件

  2. 在Java项目中将其导入项目的本地库

  3. 它认为现在您可以访问org.apache.xerces。*类。