如题,谁会阿。急求。

解决方案 »

  1.   

    dom4j就可以解析xml文件(我用过这个,还有好几种呢),至于写入数据库,应该不是什么问题吧!
      

  2.   

    dom还有sax都可以解析xml你可以去看看这方面的内容。
      

  3.   


    appName = fConfig.getInitParameter("appName");

    DocumentBuilderFactory ch = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = ch.newDocumentBuilder() ;
    Document dom = db.parse(file) ;
    NodeList nl_sr = dom.getElementsByTagName("source-rightCode");//按结点名字查找,查找结果为一个List,因为可能有多外同一等级且名为"source-rightCode"的结点
    for(int i =0;i<nl_sr.getLength();i++){
    Node n_sr = nl_sr.item(i);
    NodeList nl_c = n_sr.getChildNodes();//"source-rightCode"的一级子结点

    }//更多方法参考Class Document 
    对应XML<source-rightCode>
        <source></source>
        <right-code>10111111</right-code>
    </source-rightCode>