資源簡介
完整的畢業設計,帶論文和數據庫,直接eclipse導入就能運行

代碼片段和文件信息
//package?com.stsc.archive.xml;
package?com.stsc.archive.backup;
/*
??添加日志信息到xml文件
*/
import?java.io.*;?//Java基礎包,包含各種IO操作
import?java.util.*;?//Java基礎包,包含各種標準數據結構操作
import?javax.xml.parsers.*;?//xml解析器接口
import?org.w3c.dom.*;?//xml的DOM實現
import?org.apache.crimson.tree.xmlDocument;//寫xml文件要用到
import?javax.xml.transform.*;
import?javax.xml.transform.stream.*;
import?javax.xml.transform.dom.*;
import?com.stsc.archive.backup.CopyFile;
public?class?AppendLogxml
{
private?static?final?String?ROOT?=?“日志信息“; //根目錄
private?static?final?String?ONELOG?=?“記錄“; //一條記錄
private?static?final?String?RUNNER?=?“操作者“; //一條記錄
private?static?final?String?ACTION?=?“操作“; //一條記錄
private?static?final?String?CONTENT?=?“操作內容“; //一條記錄
private?static?final?String?ACTIONDATE?=?“操作日期“; //一條記錄
private?static?final?String?ACTIONTIME?=?“操作時間“; //一條記錄
public?AppendLogxml()
{
}
public?AppendLogxml(String?filename?LogBeanVector?logvector)
{
append(filename?logvector);
}
public?AppendLogxml(String?filename?LogBean?logbean)
{
append(filename?logbean);
}
public?boolean?append(String?filename?LogBeanVector?logvector)
{
if(?(filename?==?null)?||?(logvector?==?null)?)
{
return?false;
}
if(CopyFile.createDir(filename)?==?false) //建立目錄;
{
System.out.println(“創建目錄失敗!“);
return?false;
}
//-------------------------------------------------------
DocumentBuilderFactory?dbf?=?DocumentBuilderFactory.newInstance();
????DocumentBuilder?db?=?null;
????try?
????{
????????db?=?dbf.newDocumentBuilder();
????}?catch?(ParserConfigurationException?pce)?
????{
????????System.out.println(pce);?//出異常時輸出異常信息,然后退出,下同
????????return?false;
????}?
????
????//先獲得原有文件信息
????Document?doc?=?null;
????try
????{
????????doc?=?db.parse(filename);
????}catch(Exception?e)
????{
???? System.out.println(“doc?異常:可能不存在該日志文件現在新建一個日志文件“);
???? doc?=?db.newDocument(); //如果沒有該文件,則創建一個
???? Element?rootfirst?=?doc.createElement(ROOT);
???? doc.appendChild(rootfirst);?
????// return?false;
????}
????Element?root?=?doc.getDocumentElement();
//添加日志信息-------------
for(int?i=0;?i {
Element?student?=?doc.createElement(ONELOG);
???student.setAttribute(RUNNER?logvector.get(i).getUsername());
???root.appendChild(student);
???
???Element?name?=?doc.createElement(ACTION);
???student.appendChild(name);
???Text?tName?=?doc.createTextNode(logvector.get(i).getAction());
???name.appendChild(tName);
???
???name?=?doc.createElement(CONTENT);
???student.appendChild(name);
???tName?=?doc.createTextNode(logvector.get(i).getContent());
???name.appendChild(tName);
???
???name?=?doc.createElement(ACTIONDATE);
???student.appendChild(name);
???tName?=?doc.createTextNode(logvector.get(i).getDate());
???name.appendChild(tName);
???
???name?=?doc.createElement(ACTIONTIME);
???stude
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????14455??2006-09-14?16:19??chap04-檔案管理系統\eGovernment\backupjsp\archivebackup.jsp
?????文件???????1304??2006-09-14?16:45??chap04-檔案管理系統\eGovernment\backupjsp\backUp.jsp
?????文件???????1350??2006-09-14?17:03??chap04-檔案管理系統\eGovernment\backupjsp\backUpArchive.jsp
?????文件???????1290??2003-05-27?09:19??chap04-檔案管理系統\eGovernment\backupjsp\backUpArchive.jsp.no
?????文件??????10659??2006-09-14?16:38??chap04-檔案管理系統\eGovernment\backupjsp\backuparchivelist.jsp
?????文件???????1320??2006-09-14?16:24??chap04-檔案管理系統\eGovernment\backupjsp\backUpUnite.jsp
?????文件???????1259??2003-05-27?09:19??chap04-檔案管理系統\eGovernment\backupjsp\backUpUnite.jsp.no
?????文件???????1323??2006-09-14?16:24??chap04-檔案管理系統\eGovernment\backupjsp\backUpVolumn.jsp
?????文件???????1262??2003-05-27?09:19??chap04-檔案管理系統\eGovernment\backupjsp\backUpVolumn.jsp.no
?????文件???????1230??2006-09-14?16:49??chap04-檔案管理系統\eGovernment\backupjsp\comeBack.jsp
?????文件????????893??2006-09-14?16:58??chap04-檔案管理系統\eGovernment\backupjsp\comeBackArchive.jsp
?????文件????????912??2006-09-14?17:04??chap04-檔案管理系統\eGovernment\backupjsp\comeBackUnite.jsp
?????文件????????738??2003-05-27?09:17??chap04-檔案管理系統\eGovernment\backupjsp\comeBackUnite.jsp.no
?????文件????????911??2006-09-14?16:59??chap04-檔案管理系統\eGovernment\backupjsp\comeBackVolumn.jsp
?????文件???????4893??2006-09-14?16:35??chap04-檔案管理系統\eGovernment\backupjsp\searchResult.jsp
?????文件???????6265??2006-09-14?16:26??chap04-檔案管理系統\eGovernment\backupjsp\volumnbackup.jsp
?????文件??????18274??2006-09-14?14:50??chap04-檔案管理系統\eGovernment\filejsp\archive.jsp
?????文件??????11009??2006-09-14?14:38??chap04-檔案管理系統\eGovernment\filejsp\archivelist.jsp
?????文件??????16088??2006-09-14?14:19??chap04-檔案管理系統\eGovernment\filejsp\archive_add.jsp
?????文件??????15621??2006-09-14?14:44??chap04-檔案管理系統\eGovernment\filejsp\archive_edit.jsp
?????文件???????9977??2006-09-14?14:40??chap04-檔案管理系統\eGovernment\filejsp\archive_see.jsp
?????文件???????2951??2006-09-14?17:08??chap04-檔案管理系統\eGovernment\filejsp\handlelog.jsp
?????文件??????14891??2006-09-14?14:52??chap04-檔案管理系統\eGovernment\filejsp\SearchArchive.jsp
?????文件???????3994??2006-09-14?14:54??chap04-檔案管理系統\eGovernment\filejsp\select.jsp
?????文件????????566??2006-10-31?13:27??chap04-檔案管理系統\eGovernment\foot.htm
?????文件????????165??2002-10-29?11:22??chap04-檔案管理系統\eGovernment\images\3.gif
?????文件????????207??2002-10-29?11:22??chap04-檔案管理系統\eGovernment\images\7.gif
?????文件????????206??2002-10-29?11:22??chap04-檔案管理系統\eGovernment\images\9.gif
?????文件?????????45??2002-10-29?11:22??chap04-檔案管理系統\eGovernment\images\bg.gif
?????文件???????4327??2002-10-29?11:22??chap04-檔案管理系統\eGovernment\images\LOGO.gif
............此處省略426個文件信息
- 上一篇:車牌bmp文件讀取與字符分割、歸一化
- 下一篇:軟件建模與分析期末復習整理
評論
共有 條評論