网站制作学习网ASP→正文:asp输出xml
字体:

asp输出xml

ASP 2010/9/27 17:26:06  点击:不统计

转www.载for网站制作学习asp必.cn究
asp输出xml,早就应用到本站的rss上了,但是一直没有写出来asp代码如何输出的.下面贴出来.
代码入席:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Response.Charset = "utf-8" '这里是输出xml格式页面编码
Response.ContentType="text/xml" '这里是设置输出的是xml文件
RSSSTR = RSSSTR & "<?xml version=""1.0"" encoding=""utf-8""?>"&vbcrlf'这里是设置xml的编码
RSSSTR = RSSSTR & "<rss version=""2.0"">"&vbcrlf
RSSSTR = RSSSTR & "<channel>"&vbcrlf
RSSSTR = RSSSTR & "<title>网站制作学习网</title>"&vbcrlf
RSSSTR = RSSSTR & "<description>网站制作学习</description> "&vbcrlf
RSSSTR = RSSSTR & "<link>http//:www.forasp.cn</link>"&vbcrlf
RSSSTR = RSSSTR & "<generator>forasp.cn</generator>"&vbcrlf
RSSSTR = RSSSTR & "<language>zh-cn</language>"&vbcrlf
RSSSTR = RSSSTR & "<copyright>Copyright 2008-2009 forasp.cn</copyright>"&vbcrlf
RSSSTR = RSSSTR & "<webMaster>站长</webMaster>"&vbcrlf
RSSSTR = RSSSTR & "<email>admin@forasp.cn</email>"&vbcrlf
RSSSTR = RSSSTR & "<image>"&vbcrlf
RSSSTR = RSSSTR & " <title>网站制作学习网</title> "&vbcrlf
RSSSTR = RSSSTR & " <url>http://www.forasp.cn/images/logo2.gif</url> "&vbcrlf
RSSSTR = RSSSTR & " <link>http://www.forasp.cn/</link> "&vbcrlf
RSSSTR = RSSSTR & " <description>网站制作学习网logo</description> "&vbcrlf
RSSSTR = RSSSTR & "</image>"&vbcrlf
RSSSTR = RSSSTR & RSSCONTENT
RSSSTR = RSSSTR & "</channel>"&vbcrlf
RSSSTR = RSSSTR & "</rss>"&vbcrlf
response.Write (RSSSTR)
%>
需要注意的是asp输出xml的页面编码必须跟开头设置的输出xml页面编码一致,否则会导致乱码

原载于:本文原载于www.forasp.cn

·上一篇:asp连接mysql分页问题 >>    ·下一篇:asp多文件上传类 >>
推荐文章
最新文章