DOM4J生成XML文档
public int createXMLFile(String filename) {
int returnValue = 0;
Document document = DocumentHelper.createDocument(); //生成Document,用于管理XML文档
Element booksElement = document.addElement("books"); //添加根节点
booksElement.addComment("This is a test for dom4j, holen, 2004.9.11"); //添加注释
Element bookElement = booksElement.addElement("book"); //在跟节点books下添加一个book子节点
bookElement.addAttribute("show", "yes"); //为bookElement添加属性,并制定属性的值
Element titleElement = bookElement.addElement("title"); //为bookElement节点添加一个title子节点
titleElement.setText("Dom4j Tutorials"); //为title子节点设置文本节点内容
try {
XMLWriter writer = new XMLWriter(new FileWriter(new File(filename)));
writer.write(document); //普通格式,比较不美观
OutputFormat format =null;
// format=OutputFormat.createPrettyPrint(); //美化格式,读取后美化显示
// writer = new XMLWriter( System.out, format );
// writer.write( document );
// format = OutputFormat.createCompactFormat(); //缩减格式,读取后缩减显示
// writer = new XMLWriter( System.out, format );
// writer.write( document );
writer.close();
return
相关文档:
红色字体为主要代码
jsp页面中
<script language="javascript">
function updateDB(operate){
var objDom=new ActiveXObject("msxml.DomDocument");
var objRoot=objDom.createElement("All");
objDom.appendChild(objRoot);
var k=document.ge ......
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
create procedure [dbo].[MachiningPayedGetListByCondition]
@CustomerName varchar(50),
@CustomerPhone varchar(50),
@PactNumber varchar(50),
@Ispay bit
as
begin
set nocount on;
SELECT
dp.ID as 'MachiningPayed/@ID',
&nbs ......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<!-- 配置和优化SQL Map解析实例的设定 -->
<settings cacheModelsEnabled=" ......
from:http://www.xland.com.cn/article/7/81/0804/28778.htm
本类实现:
数据库信息导出:word,excel,json,xml,sql
数据库恢复:从sql,从文件
具体用法:
首先新建测试用数据库mytest,然后在里面建张表
PHP代码:
以下是代码片段:
--
-- 表的结构 `test`
--
CREATE TABLE `test` (
`id ......