【问题标题】:Connecting codename one to php/mysql将代号一连接到 php/mysql
【发布时间】:2016-09-12 03:45:44
【问题描述】:

在构建代号为 one 的移动应用程序时遇到以下错误。

代码在无代号项目中运行

public Actualite[] select(){
       try {
            ActualiteHandler matchHandler = new ActualiteHandler();
            // get a parser object
            SAXParser SAXparser = SAXParserFactory.newInstance().newSAXParser();
            // get an InputStream from somewhere (could be HttpConnection, for example)
            HttpConnection hc = (HttpConnection) Connector.open("http://localhost/abbes/select.php");//people.xml est un exemple
            DataInputStream dis = new DataInputStream(hc.openDataInputStream());
                        dis.toString();
            SAXparser.parse(dis, matchHandler);
            // display the result
            matches = matchHandler.getMatch();
             return matches;
        } catch (ParserConfigurationException ex) {
            ex.printStackTrace();
        } catch (SAXException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        }

             return null;
   }

这是错误

 error: cannot access File
 SAXparser.parse(dis, matchHandler);   
class file for java.io.File not found

【问题讨论】:

    标签: php xml-parsing java-me codenameone


    【解决方案1】:

    代号一不支持SAXParserjava.io.File

    我还看到您使用了 Connector,它是一个 J2ME 类并且不受支持。

    您需要使用XMLParserFileSystemStorage

    在此处查看开发者指南covering this functionality

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-08
    • 1970-01-01
    • 2017-12-12
    • 1970-01-01
    • 1970-01-01
    • 2018-11-22
    • 2013-11-09
    • 1970-01-01
    相关资源
    最近更新 更多