asp生成xml

<!-- #include file="_connection.asp" -->
<%

Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "select * from _user ",conn,3,2

total=rs.recordcount

'------------------生成xml
Set f = Server.CreateObject("Scripting.FileSystemObject")
files = "output.xml" '文件输出路径
Set myfile = f.Createtextfile(server.mappath(files),true)
myfile.writeline "<?xml version=""1.0"" encoding=""UTF-8""?>"
myfile.writeline "<Document>"

do while not rs.Eof
myfile.writeline "<user>"
myfile.writeline "<ID>"&rs("id")&"</ID>"
myfile.writeline "<username>"&rs("username")&"</username>"
myfile.writeline "<sex>"&rs("sex")&"</sex>"
myfile.writeline "</user>"
rs.MoveNext()
loop
myfile.writeline "</Document>"
myfile.close

response.write "success"
%>

你可能感兴趣的:(xml,F#,asp)