📄 elementtodoc.java
字号:
package com.stsc.archive.backup;
/*
添加元素到文件
读取文件中的元素
*/
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.*;
public final class ElementToDoc
{
/**
添加volumn的信息到doc的one元素下
*/
public static final boolean addVolumnElement(Document doc, Element one, fVolumn volumn)
{
if( (doc == null) || (one == null) || (volumn == null) )
{
return false;
}
Element student = doc.createElement("案卷表");
student.setAttribute("自动编号", Integer.toString(volumn.getVolumnid()));
one.appendChild(student);
Element name = doc.createElement("档案种类");
student.appendChild(name);
Text tName = doc.createTextNode(volumn.getArchivetype());
name.appendChild(tName);
name = doc.createElement("案卷号");
student.appendChild(name);
tName = doc.createTextNode(volumn.getVolumnno());
name.appendChild(tName);
name = doc.createElement("案卷标题");
student.appendChild(name);
tName = doc.createTextNode(volumn.getVolumntitle());
name.appendChild(tName);
name = doc.createElement("工程代号");
student.appendChild(name);
tName = doc.createTextNode(volumn.getCode());
name.appendChild(tName);
name = doc.createElement("类目号");
student.appendChild(name);
tName = doc.createTextNode(volumn.getCategory());
name.appendChild(tName);
name = doc.createElement("保管期限");
student.appendChild(name);
tName = doc.createTextNode(volumn.getRetentionperiod());
name.appendChild(tName);
name = doc.createElement("案卷起始年月");
student.appendChild(name);
Date nowdate = volumn.getStartdate();
if(nowdate != null)
{
tName = doc.createTextNode(nowdate.toString());
name.appendChild(tName);
}
name = doc.createElement("案卷截止年月");
student.appendChild(name);
nowdate = volumn.getEnddate();
if(nowdate != null)
{
tName = doc.createTextNode(nowdate.toString());
name.appendChild(tName);
}
name = doc.createElement("案卷总件数");
student.appendChild(name);
tName = doc.createTextNode(Integer.toString(volumn.getTotalnum()));
name.appendChild(tName);
name = doc.createElement("案卷总页数");
student.appendChild(name);
tName = doc.createTextNode(Integer.toString(volumn.getTotalpage()));
name.appendChild(tName);
name = doc.createElement("责任者");
student.appendChild(name);
tName = doc.createTextNode(volumn.getDuty());
name.appendChild(tName);
name = doc.createElement("密级");
student.appendChild(name);
tName = doc.createTextNode(volumn.getSecurityclass());
name.appendChild(tName);
name = doc.createElement("立卷单位");
student.appendChild(name);
tName = doc.createTextNode(volumn.getArchiveunit());
name.appendChild(tName);
name = doc.createElement("主题词");
student.appendChild(name);
tName = doc.createTextNode(volumn.getKeyword());
name.appendChild(tName);
name = doc.createElement("备注");
student.appendChild(name);
tName = doc.createTextNode(volumn.getRemark());
name.appendChild(tName);
name = doc.createElement("状态");
student.appendChild(name);
tName = doc.createTextNode(volumn.getStatus());
name.appendChild(tName);
name = doc.createElement("提要");
student.appendChild(name);
tName = doc.createTextNode(volumn.getAbstract1());
name.appendChild(tName);
//add,2003.5.22
name = doc.createElement("删除标记");
student.appendChild(name);
tName = doc.createTextNode(volumn.getDeleted());
name.appendChild(tName);
return true;
}
/**
添加archive的信息到doc的one元素下
*/
public static final boolean addArchiveElement(Document doc, Element one,
fArchive archive, String outFile)
{
if( (doc == null) || (one == null) || (archive == null) )
{
return false;
}
Element student = doc.createElement("文件表");
student.setAttribute("序号", Integer.toString(archive.getSerialno()));
one.appendChild(student);
Element name = doc.createElement("状态");
student.appendChild(name);
Text tName = doc.createTextNode(Integer.toString(archive.getStatus()));
name.appendChild(tName);
name = doc.createElement("删除标记");
student.appendChild(name);
tName = doc.createTextNode(archive.getDeleted());
name.appendChild(tName);
name = doc.createElement("同步标记");
student.appendChild(name);
tName = doc.createTextNode(Integer.toString(archive.getRepflag()));
name.appendChild(tName);
name = doc.createElement("档案种类");
student.appendChild(name);
tName = doc.createTextNode(archive.getArchivetype());
name.appendChild(tName);
name = doc.createElement("文件种类载体种类");
student.appendChild(name);
tName = doc.createTextNode(archive.getFiletype());
name.appendChild(tName);
name = doc.createElement("题名分说明");
student.appendChild(name);
tName = doc.createTextNode(archive.getTitle());
name.appendChild(tName);
name = doc.createElement("一般文献类型标识");
student.appendChild(name);
tName = doc.createTextNode(archive.getLiteraturetype());
name.appendChild(tName);
name = doc.createElement("题名说明");
student.appendChild(name);
tName = doc.createTextNode(archive.getTitleremark());
name.appendChild(tName);
name = doc.createElement("文件编号图号页号");
student.appendChild(name);
tName = doc.createTextNode(archive.getFileno());
name.appendChild(tName);
name = doc.createElement("成文日期载体形成时间");
student.appendChild(name);
Date nowdate = archive.getDecryptiondate();
if(nowdate != null)
{
tName = doc.createTextNode(nowdate.toString());
name.appendChild(tName);
}
name = doc.createElement("主题词");
student.appendChild(name);
tName = doc.createTextNode(archive.getKeyword());
name.appendChild(tName);
name = doc.createElement("文件年代工程代号载体年代");
student.appendChild(name);
tName = doc.createTextNode(archive.getCode());
name.appendChild(tName);
name = doc.createElement("类目号");
student.appendChild(name);
tName = doc.createTextNode(archive.getCategory());
name.appendChild(tName);
name = doc.createElement("页数");
student.appendChild(name);
tName = doc.createTextNode(Integer.toString(archive.getPagenumber()));
name.appendChild(tName);
name = doc.createElement("责任者");
student.appendChild(name);
tName = doc.createTextNode(archive.getDuty());
name.appendChild(tName);
name = doc.createElement("其他责任者");
student.appendChild(name);
tName = doc.createTextNode(archive.getOtherduty());
name.appendChild(tName);
name = doc.createElement("电子文档名");
student.appendChild(name);
tName = doc.createTextNode(archive.getElectronicfilename());
name.appendChild(tName);
name = doc.createElement("附件标题");
student.appendChild(name);
tName = doc.createTextNode(archive.getAttachmenttitle());
name.appendChild(tName);
name = doc.createElement("备注");
student.appendChild(name);
tName = doc.createTextNode(archive.getMemo());
name.appendChild(tName);
name = doc.createElement("份数");
student.appendChild(name);
tName = doc.createTextNode(Integer.toString(archive.getCopys()));
name.appendChild(tName);
name = doc.createElement("实物借出份数");
student.appendChild(name);
tName = doc.createTextNode(Integer.toString(archive.getLendnum()));
name.appendChild(tName);
name = doc.createElement("密级");
student.appendChild(name);
tName = doc.createTextNode(archive.getSecurityclass());
name.appendChild(tName);
System.out.println("aaaaaaaaaaaaaaaaaaa");
name = doc.createElement("保密期限");
student.appendChild(name);
tName = doc.createTextNode(Integer.toString(archive.getSecurityterm()));
name.appendChild(tName);
System.out.println("bbbbbbbbbbbbbbbbbbbbbbbb");
name = doc.createElement("解密日期");
student.appendChild(name);
nowdate = archive.getDecryptiondate();
if(nowdate == null)
System.out.println("date is null");
else
{
tName = doc.createTextNode(archive.getDecryptiondate().toString());
name.appendChild(tName);
}
name = doc.createElement("保管期限");
student.appendChild(name);
tName = doc.createTextNode(archive.getRetentionperiod());//6.3 modify int to string
if(tName != null)
name.appendChild(tName);
name = doc.createElement("归档日期");
student.appendChild(name);
nowdate = archive.getArchivedate();
if(nowdate != null)
{
tName = doc.createTextNode(nowdate.toString());
name.appendChild(tName);
}
name = doc.createElement("销毁日期");
student.appendChild(name);
nowdate = archive.getDestroydate();
if(nowdate != null)
{
tName = doc.createTextNode(nowdate.toString());
name.appendChild(tName);
}
name = doc.createElement("存址号");
student.appendChild(name);
tName = doc.createTextNode(archive.getArchivalcode());
name.appendChild(tName);
name = doc.createElement("全宗号");
student.appendChild(name);
tName = doc.createTextNode(archive.getDossierno());
name.appendChild(tName);
name = doc.createElement("电子档号");
student.appendChild(name);
tName = doc.createTextNode(archive.getArchiveno());
name.appendChild(tName);
name = doc.createElement("件号");
student.appendChild(name);
tName = doc.createTextNode(archive.getUnitno());
name.appendChild(tName);
name = doc.createElement("历次物理归档情况");
student.appendChild(name);
tName = doc.createTextNode(archive.getFilingtrace());
name.appendChild(tName);
name = doc.createElement("移交人");
student.appendChild(name);
tName = doc.createTextNode(archive.getHandover());
name.appendChild(tName);
name = doc.createElement("归档稿本版本情况说明");
student.appendChild(name);
tName = doc.createTextNode(archive.getFilingscripts());
name.appendChild(tName);
name = doc.createElement("档案人员再次鉴定时间");
student.appendChild(name);
tName = doc.createTextNode(archive.getReappraisedates());
name.appendChild(tName);
name = doc.createElement("附注");
student.appendChild(name);
tName = doc.createTextNode(archive.getAnnotation());
name.appendChild(tName);
name = doc.createElement("提要");
student.appendChild(name);
tName = doc.createTextNode(archive.getAbstractmsg());
name.appendChild(tName);
name = doc.createElement("传阅意见");
student.appendChild(name);
tName = doc.createTextNode(archive.getSuggest());
name.appendChild(tName);
System.out.println("ccccccccccccccccc");
name = doc.createElement("流程跟踪");
student.appendChild(name);
tName = doc.createTextNode(archive.getRecordtransfer());
name.appendChild(tName);
name = doc.createElement("案卷号");
student.appendChild(name);
tName = doc.createTextNode(archive.getVolumnNo());
name.appendChild(tName);
//5.23 add
String filepathname = archive.getAttachmentPath();
name = doc.createElement("附件路径");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -