資源簡介
java實現讀取xml文件內容

代碼片段和文件信息
package?org.dom4j.test;
import?java.io.BufferedReader;
import?java.io.File;
import?java.io.FileInputStream;
import?java.io.FileNotFoundException;
import?java.io.IOException;
import?java.io.InputStreamReader;
public?class?FlashTestDemo{
public?void?init()?throws?IOException{
try{
File?file?=?new?File(“D:\\FlashDemo\\FlashDemoTest\\src\\org\\dom4j\\test\\Firstxml.xml“);
FileInputStream?fis?=?new?FileInputStream(file);
InputStreamReader?reader?=?new?InputStreamReader(fis);
BufferedReader?read?=?new?BufferedReader(reader);
int?count?=?0;
String?ss?=?read.readLine();
StringBuffer?str?=?new?StringBuffer();
while(!““.equals(ss)&&ss!=null){
count++;
System.out.println(count);
ss?=?read.readLine();
if(ss!=null){
str.append(ss);
}
}
System.out.println(count);
System.out.println(str.toString());
}catch(FileNotFoundException?e){
e.printStackTrace();
}
}
public?static?void?main(String[]?args)?throws?IOException{
FlashTestDemo?ft?=?new?FlashTestDemo();
ft.init();
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????87608??2008-07-24?16:09??FlashDemo\.me
?????文件??????21542??2008-07-24?10:55??FlashDemo\.me
?????文件????????458??2008-07-24?16:51??FlashDemo\.me
?????文件????????779??2008-07-24?16:58??FlashDemo\.me
?????文件???????1197??2008-07-24?17:40??FlashDemo\.me
?????文件??????44883??2008-07-24?10:47??FlashDemo\.me
?????文件???????1400??2008-07-24?13:08??FlashDemo\.me
?????文件???????2859??2008-07-24?16:31??FlashDemo\.me
?????文件????????287??2008-07-24?11:24??FlashDemo\.me
?????文件??????48761??2008-07-24?10:47??FlashDemo\.me
?????文件???????1399??2008-07-24?13:10??FlashDemo\.me
?????文件??????????0??2008-07-24?15:59??FlashDemo\.me
?????文件??????44062??2008-07-24?10:47??FlashDemo\.me
?????文件??????57016??2008-07-24?10:47??FlashDemo\.me
?????文件????????304??2008-07-24?16:45??FlashDemo\.me
?????文件????????247??2008-07-24?16:11??FlashDemo\.me
?????文件????????552??2008-07-24?16:53??FlashDemo\.me
?????文件????????531??2008-07-24?16:18??FlashDemo\.me
?????文件????????835??2008-07-24?17:01??FlashDemo\.me
?????文件????????733??2008-07-24?16:58??FlashDemo\.me
?????文件???????2262??2008-07-24?11:17??FlashDemo\.me
?????文件???????1535??2008-07-24?12:44??FlashDemo\.me
?????文件????????139??2008-07-24?15:52??FlashDemo\.me
?????文件???????1410??2008-07-24?13:01??FlashDemo\.me
?????文件???????1404??2008-07-24?13:05??FlashDemo\.me
?????文件????????369??2008-07-24?11:09??FlashDemo\.me
?????文件???????1172??2008-07-24?16:33??FlashDemo\.me
?????文件???????1244??2008-07-24?17:56??FlashDemo\.me
?????文件??????46169??2008-07-24?10:47??FlashDemo\.me
?????文件???????2821??2008-07-24?16:32??FlashDemo\.me
............此處省略543個文件信息
評論
共有 條評論