<
!
--#include file="conn.asp"--
>
<%
strC = " < ?xml version =""1.0"" encoding =""utf-8""? > " & vbcrlf
strC = strC&" < root >" & vbcrlf
set rs = server.CreateObject("adodb.recordset")
set rs1 = server.CreateObject("adodb.recordset")
sql = "select anclassid,anclass from bsort order by anclassidorder"
rs.open sql,conn,1,1
do while not rs.eof
strC = strC&" < bigsort anclassid ='"&rs(0)&"' name ='"&rs(1)&"' >"& vbcrlf
sql1 = "select nclassid,nclass from ssort where anclassid = "&rs(0)&" order by nclassidorder"
rs1.open sql1,conn,1,1
do while not rs1.eof
strC = strC&" < ssort id ='"&rs1(0)&"' name ='"&rs1(1)&"' >"&rs1(1)&" </ssort>"& vbcrlf
rs1.movenext
loop
rs1.close
strC = strC&" </bigsort>"& vbcrlf
rs.movenext
loop
rs.close
strC = strC&" </root>" & vbcrlf
call saveXml(strC,"111111.xml")
Function saveXml(Text,FileName)
dim xmldoc,path
set xmldoc= server.CreateObject("MSXML.DOMDocument")
path = Server.MapPath(FileName)
xmldoc.LoadXML(Text)
xmldoc.save(path)
set xmldoc= nothing
End Function
%>
转载地址: http://shijie.blog.51cto.com/116032/116646
<%
strC = " < ?xml version =""1.0"" encoding =""utf-8""? > " & vbcrlf
strC = strC&" < root >" & vbcrlf
set rs = server.CreateObject("adodb.recordset")
set rs1 = server.CreateObject("adodb.recordset")
sql = "select anclassid,anclass from bsort order by anclassidorder"
rs.open sql,conn,1,1
do while not rs.eof
strC = strC&" < bigsort anclassid ='"&rs(0)&"' name ='"&rs(1)&"' >"& vbcrlf
sql1 = "select nclassid,nclass from ssort where anclassid = "&rs(0)&" order by nclassidorder"
rs1.open sql1,conn,1,1
do while not rs1.eof
strC = strC&" < ssort id ='"&rs1(0)&"' name ='"&rs1(1)&"' >"&rs1(1)&" </ssort>"& vbcrlf
rs1.movenext
loop
rs1.close
strC = strC&" </bigsort>"& vbcrlf
rs.movenext
loop
rs.close
strC = strC&" </root>" & vbcrlf
call saveXml(strC,"111111.xml")
Function saveXml(Text,FileName)
dim xmldoc,path
set xmldoc= server.CreateObject("MSXML.DOMDocument")
path = Server.MapPath(FileName)
xmldoc.LoadXML(Text)
xmldoc.save(path)
set xmldoc= nothing
End Function
%>
转载地址: http://shijie.blog.51cto.com/116032/116646