/**
* 描述:数据库初始化基本类
*
* @作者 王群
* @创建日期 2010-04-08
* @修改人 xxx
* @修改日期 xxx
* @检查人 xxx
* @检查日期 xxx
*/
import java.sql.SQLException;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.oumasoft.bstmanage.ibatis.SqlMapConfig;
import com.oumasoft.bstmanage.ibatis.data.JsgnPo;
import com.oumasoft.bstmanage.ibatis.data.Test;
import java.util.*;
import org.w3c.dom.*;
import java.io.*;
import javax.servlet.http.HttpServletRequest;
import javax.xml.transform.stream.*;
import org.w3c.dom.*;
import javax.xml.transform.*;
import javax.xml.parsers.*;
import javax.xml.transform.dom.*;
import org.apache.log4j.Logger;
import com.oumasoft.bstmanage.ibatis.dao.ClientDao;
public class InitDBDao{
static Logger logger = Logger.getLogger(ClientDao.class.getName());
static SqlMapClient sqlMap = null;
private static File file = null;//读写文件
private static DocumentBuilderFactory factory = null;
private static DocumentBuilder builder = null;
/**
* 将修改的内容添加到xml文件中
* @param document xml节点
* @param filename 文件路径
* @return 是否写入成功
*/
public static boolean doc2XmlFile(Document document, String filename) {
boolean flag = true;
try {
/** 将document中的内容写入文件中 */
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
/** 编码 */
//transformer.setOutputProperty(OutputKeys.ENCODING, "GBK");
DOMSource source = new DOMSource(document);
//判断路径开头有没有“\”如果有则去掉
filename = "C".equals(filename.charAt(0)) ? filename : filename.substring(1);
StreamResult result = new StreamResult(new FileOutputStream(filename));
transformer.transform(source, result);
} catch (Exception ex) {
flag = false;
ex.printStackTrace();
}
return flag;
}
/**
* 读取xml文件
* @param filename 文件路径
* @return 文件节点
*/
public stati