asp輸出xml,早就應(yīng)用到本站的rss上了,但是一直沒有寫出來asp代碼如何輸出的.下面貼出來.
代碼入席:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Response.Charset = "utf-8" '這里是輸出xml格式頁面編碼
Response.ContentType="text/xml" '這里是設(shè)置輸出的是xml文件
RSSSTR = RSSSTR & "<?xml version=""1.0"" encoding=""utf-8""?>"&vbcrlf'這里是設(shè)置xml的編碼
RSSSTR = RSSSTR & "<rss version=""2.0"">"&vbcrlf
RSSSTR = RSSSTR & "<channel>"&vbcrlf
RSSSTR = RSSSTR & "<title>網(wǎng)站制作學(xué)習(xí)網(wǎng)</title>"&vbcrlf
RSSSTR = RSSSTR & "<description>網(wǎng)站制作學(xué)習(xí)</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>網(wǎng)站制作學(xué)習(xí)網(wǎng)</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>網(wǎng)站制作學(xué)習(xí)網(wǎng)logo</description> "&vbcrlf
RSSSTR = RSSSTR & "</image>"&vbcrlf
RSSSTR = RSSSTR & RSSCONTENT
RSSSTR = RSSSTR & "</channel>"&vbcrlf
RSSSTR = RSSSTR & "</rss>"&vbcrlf
response.Write (RSSSTR)
%>
需要注意的是asp輸出xml的頁面編碼必須跟開頭設(shè)置的輸出xml頁面編碼一致,否則會導(dǎo)致亂碼
更多信息請查看IT技術(shù)專欄