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)航:
           
          主站蜘蛛池模板: 遵义市| 安仁县| 巧家县| 邢台县| 南宫市| 商河县| 房产| 莆田市| 邵武市| 陕西省| 西藏| 虎林市| 通化市| 平湖市| 灌阳县| 隆安县| 都江堰市| 班戈县| 宜君县| 永丰县| 唐河县| 通渭县| 望城县| 横峰县| 珲春市| 安新县| 巧家县| 西平县| 湾仔区| 永兴县| 综艺| 菏泽市| 新平| 龙门县| 阿克| 石家庄市| 嘉鱼县| 自贡市| 中宁县| 额济纳旗| 咸丰县|