日期:2010-05-24 09:14:00 来源:本站整理
<b>ASP动态生成XML的实现办法</b>[网站编程]
本文“<b>ASP动态生成XML的实现办法</b>[网站编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
确认目录有写权限
- <!--#include virtual="conn/conndb.asp"-->
- <%
- strC = "<?xml version=""1.0"" encoding=""utf-8""?> " & vbcrlf
- strCstrC = strC&" <list>" & vbcrlf
- set rs = server.CreateObject("adodb.recordset")
- sql = "select top 10 name,pic,d,summary from database where flag=1"
- rs.open sql,conn,1,1
- do while not rs.eof
- src="http://tommyhu.cn/piaoupload/"&rs(1)
- link="http://tommyhu.cn/list-"&rs(2)&".html"
- strCstrC = strC&"<img1 title='"&rs(0)&"' src='"&src&"' link='"&link&"' description='"&left(rs(3),10)&"' />"& vbcrlf
- rs.movenext
- loop
- rs.close
- strCstrC = strC&"</list>" & vbcrlf
- call saveXml(strC,"test.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
- %>
参考代码
- <!--#include file="conn.asp"-->
- <%
- strC = "<?xml version=""1.0"" encoding=""utf-8""?> " & vbcrlf
- strCstrC = 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
- strCstrC = 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
- strCstrC = strC&"<ssort id='"&rs1(0)&"' name='"&rs1(1)&"'>"&rs1(1)&" </ssort>"& vbcrlf
- rs1.movenext
- loop
- rs1.close
- strCstrC = strC&"</bigsort>"& vbcrlf
- rs.movenext
- loop
- rs.close
- strCstrC = 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
- %>
以上是“<b>ASP动态生成XML的实现办法</b>[网站编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |
评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论