Java XML

          Exist 的調(diào)用

          1.load 文件的時候

           /**
            * @param files
            * @param col
            * @throws XMLDBException
            */
           private void addFiles(Collection col) throws XMLDBException {
            File d = new File(dirPath);
                  if(!(d.canRead() && d.isDirectory()))
                      throw new RuntimeException("Cannot read directory: " + dirPath);
                  File[] files = d.listFiles();
            for(int i = 0; i < files.length; i++) {
                      if(files[i].isFile()) {
                          System.out.println("Storing " + files[i].getName());
                       DBUtils.addXMLResource(col, files[i].getName(), files[i]);
                      }
                  }
            System.out.println("All files stored.");
           }


           public static void addXMLResource(Collection col, String resourceId, File file) throws XMLDBException {
            XMLResource res = (XMLResource)col.createResource(
              resourceId, "XMLResource");
            res.setContent(file);
            col.storeResource(res);
           }


          posted on 2008-06-03 23:44 dawson 閱讀(68) 評論(0)  編輯  收藏 所屬分類: eXist


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 田林县| 吴江市| 双辽市| 田东县| 定西市| 泰安市| 贺兰县| 涿州市| 旌德县| 永修县| 玉林市| 碌曲县| 大悟县| 抚远县| 大兴区| 焉耆| 巨野县| 苍溪县| 县级市| 聂拉木县| 溆浦县| 梅河口市| 土默特右旗| 北川| 云浮市| 河北省| 渝北区| 达拉特旗| 琼结县| 新民市| 大埔县| 高邑县| 莒南县| 离岛区| 望城县| 古浪县| 满城县| 杭州市| 寻乌县| 周宁县| 邹平县|