新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> XML网站展示,XML源代码,XML编程示例。 本版仅接受原创、转贴、网站展示,具体的技术交流请前往各相关版块。
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 XML源码及示例(仅原创和转载) 』 → [原创]自己弄的一个ASP生成XML文件的小程序 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 49155 个阅读者浏览上一篇主题  刷新本主题   平板显示贴子 浏览下一篇主题
     * 贴子主题: [原创]自己弄的一个ASP生成XML文件的小程序 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     pangguigao 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:2
      积分:83
      门派:XML.ORG.CN
      注册:2005/11/11

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给pangguigao发送一个短消息 把pangguigao加入好友 查看pangguigao的个人资料 搜索pangguigao在『 XML源码及示例(仅原创和转载) 』的所有贴子 引用回复这个贴子 回复这个贴子 查看pangguigao的博客楼主
    发贴心情 [原创]自己弄的一个ASP生成XML文件的小程序

    看了代码后如果有不清楚的地方可以加我QQ496410994或用EMAIL:pangguigao@163.com联系我,欢迎大家到我Blog逛逛http://enet.bigwww.com

    <%response.buffer=true%>
    <!--#include file="connection.asp"-->'连接数据库的文件,这很简单的
    <!--#include file="function.asp"-->'函数文件,这个文件可有可无
    <%
    Dim xmldom,rss,newnode,MyBlogTitle,MyBlogURL,BlogDescription,Language,WebMaster,QQ,link,title,author,SubmitDate,origin,content,pi
    Set xmlDom = server.CreateObject("Microsoft.XMLDOM")   '创建XMLDOM对象实例
       Set rss = xmlDom.createElement("rss")   '创建节点实例
     xmlDom.appendChild rss
     Set newNode = xmlDom.createElement("MyBlog")  
     rss.appendChild newNode
     Set myblogtitle=xmldom.createelement("MyBlogTitle")
     myblogtitle.text="庞贵高的Blog"    '为属性赋值
     newnode.appendchild myblogtitle
     Set myblogURL=xmldom.createelement("MyBlogURL")
     myblogURL.text="http://enet.bigwww.com"
     newnode.appendchild myblogurl
     Set blogdescription=xmldom.createelement("BlogDescription")
     blogdescription.text="庞贵高的Blog,网络日记,网志,ASP,ASP.NET,JSP,JAVA,PHP,VB,JAVASCRIPT"
     newnode.appendchild blogdescription
     Set language=xmldom.createelement("Language")
     language.text="Zh-cn"
     newnode.appendchild language
     Set webmaster=xmldom.createelement("WebMaster")
     webmaster.text="pangguigao@163.com"
     newnode.appendchild webmaster
     Set qq=xmldom.createelement("QQ")
     QQ.text="496410994"
     newnode.appendchild qq
    '以下查询数据库
    Dim sql,rs
    sql="select top 10 * from wenzhang_sbi order by submit_date desc"
    db.execute(sql)
    Set rs=server.CreateObject("adodb.recordset")
    rs.open sql,db,1
    If Not rs.eof And Not rs.bof Then
        Do While Not rs.eof
     Dim newweblog
    Set newweblog=xmldom.createelement("NewWebLog") '创建节点
    newnode.appendChild newweblog
    Set link=xmldom.createelement("link")
    link.text="http://enet.bigwww.com/sbi_jitineirong.asp?id=" & rs("id")
    Set title=xmldom.createelement("title")
    title.text=rs("title")
    Set author=xmldom.createelement("author")
    author.text=rs("zuozhe")
    Set submitdate=xmldom.createelement("SubmitDate")
    submitdate.text=rs("submit_date")
    Set origin=xmldom.createelement("Origin")
    origin.text=rs("laiyuan")
    '我的网站是用ASP直接生成HTML的,所以的用到filesystemobject组件
    '下面用filesystemobject读取文件
    Dim fileobj
    Set fileobj=server.CreateObject("scripting.filesystemobject")
    Dim textfile
    Set textfile=fileobj.opentextfile(server.mappath("htmlfiles/" & rs("name") & ".htm"))
    Do While Not textfile.atendofstream
    Dim weblog_body
    weblog_body=textfile.readline
    Loop
    textfile.close
    Set content=xmldom.createelement("content")
    content.text=htmlencode(server.htmlencode(weblog_body))
    NewWebLog.appendchild Link
    NewWebLog.appendchild title
    NewWebLog.appendchild author
    NewWebLog.appendchild submitdate
    NewWebLog.appendchild origin
    NewWebLog.appendchild content
         rs.movenext
      Loop
    Else
        nonewweblog
        Set nonewweblog=xmldom.createelement("nonewweblog")
        newnode.appendchild nonewweblog
    End If
    '下面开始创建XML文件
    Set pi=xmldom.createprocessinginstruction("xml","version='1.0'")
    xmldom.insertbefore pi,xmldom.childnodes(0)
    xmldom.save server.mappath("xml/" & "blogXML.xml") '把XML文件保存到指定文件夹
    response.redirect "xml/blogxml.xml"  '当用户点击时先生成XML,再重新定向到XML页
    %>


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/11/11 21:03:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 XML源码及示例(仅原创和转载) 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/4/27 21:48:02

    本主题贴数12,分页: [1] [2]

     *树形目录 (最近20个回帖) 顶端 
    主题:  [原创]自己弄的一个ASP生成XML文件的小程序(3292字) - pangguigao,2005年11月11日
        回复:  一楼写的真详细,,如果更深入解释更好了,因为这里说到底应该会有初学者吧(67字) - linguoheng1234,2008年1月22日
        回复:  我帮你顶一下 呵呵(17字) - dinoworld,2007年6月30日
        回复:  thank ou very much!(19字) - minmin0876,2007年4月25日
        回复:  hehe 学习学习(16字) - hizhfei,2007年3月25日
        回复:  马上研究(8字) - zj2302552,2006年12月14日
        回复:  研究下(6字) - hedoyu1,2006年8月7日
        回复:  不错。偶当教程用了!(20字) - chyf1982,2006年7月25日
        回复:  研究研究~(9字) - kevin69,2006年4月28日
        回复:  up(2字) - arena,2006年4月26日
        回复:  学习一下(8字) - jdzcq,2006年4月25日
        回复:  有点意思,请问如何让asp定时的或者在某一种情况下实时的生成xml文件!qq:85781870..(78字) - epsun,2006年2月25日

    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    140.625ms