⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trans_xml.asp

📁 武汉软件园人力资源管理系统完整源代码,希望大家能够多多交流.
💻 ASP
字号:
<!--#include file="../Include/conn.asp"-->
<%
dim res
set res=server.CreateObject("ADODB.recordset")
res.Open "select (high_dept+'/'+dept_meanid) as 'id',dept_name from dept where dept_state='启用'",conn,3,1

dim xmldoc
set xmldoc=server.CreateObject("Microsoft.XMLDOM")                     '创建DOM对象            
if(xmldoc.childnodes.length = 0) then
    
	set Depts=xmldoc.CreateNode("element","Depts","")                     '创建根结点
	xmldoc.appendchild(Depts)                                             '添加根结点
	
	Set department = xmldoc.CreateNode("element","department","")        '创建第一个子结点
	Depts.appendchild(department)                                        '添加子结点 
	
	Set Id=xmldoc.CreateNode("element","Id","") 
	Id.text="TB/DP0000"     
    department.appendchild(Id)                                       

	Set name=xmldoc.CreateNode("element","Name","")
	name.text="TB"
    department.appendchild(name)
	
    
	Do While Not res.eof=True                                                '创建数据子结点
	    Set department = xmldoc.CreateNode("element","department","")        '创建子结点
		Depts.appendchild(department)                                        '添加子结点 
		
		Set Id=xmldoc.CreateNode("element","Id","")         
		Id.text=res("id")                                               '加入子点结中数据
		department.appendchild(Id)                                      '添加子结点

		Set name=xmldoc.CreateNode("element","Name","")
		name.text=res("dept_name")
		department.appendchild(name)

        res.movenext
	Loop
end If
res.close
conn.close
Set res=Nothing
Set conn=Nothing
    
xmldoc.save server.mappath("Dept_struct.xml")

Response.Redirect "Struct_show.asp"
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -