java遍历文件夹解析xm代码l

zhanggt

贡献于2012-09-03

字数:3981 关键词: XML解析

package com.monitor.resolve; import java.io.File; import java.sql.Date; import java.sql.PreparedStatement; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.Node; import org.dom4j.io.SAXReader; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; import com.monitor.entity.Fcs13; import com.monitor.service.TimeFor; @Service public class ReadXmlService { Log log = LogFactory.getLog(TimeFor.class); @Autowired(required = false) private JdbcTemplate jdbc; public JdbcTemplate getJdbc() { return jdbc; } public void setJdbc(JdbcTemplate jdbc) { this.jdbc = jdbc; } private PreparedStatement ps=null; Fcs13 book = new Fcs13(); public void resolve(){ refreshFileList("D:\\SAICFTEST\\INTERFACE\\SAICF_FCS\\FCS13_RFIDMONITORINFO\\"); } private void refreshFileList(String strPath) { String str = null; String strctl = null; File dir = new File(strPath); File[] files = dir.listFiles(); String fileName = null; String fileCtlName = null; List list = new ArrayList(); List listctl = new ArrayList(); if (files == null) return; for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { refreshFileList(files[i].getAbsolutePath()); } else { String strFileName = files[i].getAbsolutePath().toLowerCase(); String strFileNamedaxie = strFileName.toUpperCase(); if(strFileName.endsWith(".xml")){ str = strFileName; File str1 = new File(str.trim()); fileName = str1.getName(); list.add(fileName); } } } for(int j = 0;j

下载文档,方便阅读与编辑

文档的实际排版效果,会与网站的显示效果略有不同!!

需要 3 金币 [ 分享文档获得金币 ]
0 人已下载

下载文档

相关文档