ASP如何生成XML文件

ASP如何生成XML文件,第1张

可以

1、用FSO,就当是一个普通的文本文件,不过内容是XML标签

2、用XML对象,如Server.CreateObject("MSXML2.DOMDocument"),按XML节点格式 *** 作

<!--#include file="inc/connm.asp"-->

<%

msToToalPage = 0

CPage = 16

msPage= Trim(Request("pg"))

msSID = Trim(Request("msSID"))

msKName = Trim(Request("msKName"))

msSName = Trim(Request("msSName"))

msTypeID = Trim(Request("msTypeID"))

IF IsNumeric(msSID)=False THEN

msSID =""

END IF

IF msPage = "" THEN msPage = 1

msSql = "select a.music_id,a.mname,b.singer_mname,a.path,a.mname,a.singer_id"

msSql = msSql &" from mgl_blog_music_lib a,mgl_blog_music_singer b"

msSql = msSql &" where a.mname<>'#' and a.singer_id=b.singer_id"

msSql = msSql &" and a.sts='A'"

IF msSID<>"" THEN

msSql = msSql &" and b.singer_id='" &msSID &"'"

END IF

IF msKName <>"" THEN

msSql = msSql &" and a.ename='" &msKName &"'"

END IF

IF msSName <>"" THEN

msSql = msSql &" and b.singer_ename='" &msSName &"'"

END IF

IF msTypeID <>"" THEN

msSql = msSql &" and a.type_id='" &msTypeID &"'"

END IF

msSql = msSql &" order by a.sts_date DESC"

'Response.write msSql

'Response.end

set rsLib = server.createobject("ADODB.recordset")

IF Not IsObject(Conn) Then LinkDataBase

rsLib.open msSql,Conn,3,1

IF rsLib.RecordCount>0 Then

rsLib.pagesize = CPage

rsLib.AbsolutePage = msPage

msToToalPage = rsLib.PageCount

END IF

Response.write "<?xml version='1.0' encoding='UTF-8'?>" &vbCrLf

Response.write "<data>"&vbCrLf

Response.write "<web>"&vbCrLf

while not rsLib.EOF and counter<CPage

Response.Write " <line mid=""" &Trim(rsLib("music_id")) &""" sid=""" &Trim(rsLib("Singer_ID")) &""" mname=""" &Trim(rsLib("mname")) &""" fpath=""" &Trim(rsLib("path")) &""" lid=""" &Trim(rsLib("path")) &""" sname=""" &Trim(rsLib("Singer_MName")) &"""/>"&vbCrLf

counter=counter+1

rsLib.movenext

wend

Response.write "</web>"&vbCrLf

Response.write "<web>"&vbCrLf

Response.Write " <line msToToalPage=""" &msToToalPage &""" msCPage=""" &Cpage &""" msPage=""" &msPage &"""/>"&vbCrLf

Response.write "</web>"&vbCrLf

Response.write "</data>"

rsLib.close

set rsLib =nothing

%>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/11894111.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存