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

    >> 精华版 是对 精华区 的 提升.
    精华版 将以结构化和分类的方式整理全站的精华文章。以便于广大站友更快地找到自己所需的信息
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 精华版 』 → [020401050]DOM与ASP的接口问题? 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 15869 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [020401050]DOM与ASP的接口问题? 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     yuji1998 帅哥哟,离线,有人找我吗?魔羯座1981-12-22
      
      
      威望:5
      头衔:蓝色先锋
      等级:大二(研究C++)
      文章:212
      积分:1059
      门派:XML.ORG.CN
      注册:2004/4/10

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给yuji1998发送一个短消息 把yuji1998加入好友 查看yuji1998的个人资料 搜索yuji1998在『 精华版 』的所有贴子 访问yuji1998的主页 引用回复这个贴子 回复这个贴子 查看yuji1998的博客楼主
    发贴心情 [020401050]DOM与ASP的接口问题?

    [原作者:cmy8132]
                 [疑问点击]  
    我做的一个小问题是知识查询与疑难问题系统,用的是asp和xml做的,其中的查询模块如下实现,如果用C,C++如何实现?
    <html>t="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>查询结果</title>
    <script language="javascript" type="text/javascript">
    <!--
    function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    //-->
    </script>
    </head>

    <body bgcolor="#000000">
    <div align="center">
      <center>
      <table border="0" width="611" cellspacing="0" cellpadding="0" height="528" background="images/i-3-1.gif">
        <!--DWLayoutTable-->
        <tr>
          <td width="609" height="539" valign="top" background="images/t-02.gif">
            <div align="right">
              <table border="0" width="91%" cellspacing="5" cellpadding="5" height="477">
                <!--DWLayoutTable-->
                <tr>
                  <td width="1" height="80"></td>
                  <td width="100%"> <p align="center"><font color="#FF3366" size="4" face="仿宋_GB2312"><em><strong>我
                       们 一 直 在 努 力</strong></em></font></td>
                </tr>
                <tr bgcolor="#006666">
                  <td height="61" colspan="2" valign="top"><div align="center"><font color="#00FF00" size="6"><strong>问题答案是</strong></font></div></td>
                </tr>
                <tr>
                  <td height="349" colspan="2" valign="middle" bgcolor="#006460">
                    <div align="left">
                      <form name="form1" method="post" action="">
                        <p>

                  <%
          question=request.form("std_question")
          question=trim(question)
          length=len(question)
          question=left(question,length-4)
          keywords=SPLIT(question,"的")
         keyword_num=ubound(keywords)+1
         Set DomXML=Server.CreateObject("MSXML.DOMDocument")
         DomXML.Load "d:/知识查询与疑难问题系统/ds.XML"
         Set root=DomXML.documentElement
         set childNodes=root.selectNodes("//"&keywords(0)) '查找符合第一个关键字的所有节点
         if childNodes.length=0 then response.Write "<font color='#FF3366'>"&"对不起,找不到你要的问题的答案!" &"</font>"

         dim stack()
         redim stack(100,1)
         top=0
         for i=0 to childNodes.length-1
             set child=childNodes.item(i)
             set stack(top,0)=child
             stack(top,1)=0
             top=top+1
         next

         answer_order=1
         while top>0
             top=top-1
             set parent=stack(top,0)
             key_i=stack(top,1)
             if key_i+1=keyword_num then  '关键字匹配完毕
                       answer=question
                       answer=CStr(answer_order)&"."&answer
                       answer_order=answer_order+1
                       set answerNodes=parent.childNodes
                       if answerNodes.length>1 then
                          answer=answer&"可分为:"
                       else
                          answer=answer&"是:"
                       end if
                       for m=0 to answerNodes.length-2
                            set child=answerNodes.item(m)
                            if child.nodeType=1 or child.nodetype=2 then         'Current node is element node
                              answer=answer&child.nodename&"、"
                            elseif child.nodeType=3 or child.nodeType=4 then
                              answer=answer&"
    "&child.text&"
    "
                            end if
                       next
                       set child=answerNodes.item(m)
                       if m>0 then
                         if child.nodeType=1 then
                            answer=answer&"和"&child.nodeName&"。<hr>"
                         elseif child.nodeType=3 or child.nodeType=4 then
                           answer=answer&"和"&child.text&"。<hr>"
                         end if
                       else
                          if child.nodeType=1 then
                            answer=answer&child.nodeName&"。<hr>"
                          elseif child.nodeType=3 or child.nodeType=4 then
                            answer=answer&child.text&"。<hr>"
                          end if
                       end if
                       response.Write "<font color='#FF3366'>"&answer&"</font>"
             else
             set childSet=parent.childNodes
             finded=FALSE
             for j=0 to childSet.length-1
                set child=childSet.item(j)
                childName=child.nodeName
                if strcomp(childName,keywords(key_i+1))=0 then
                   set stack(top,0)=child
                   stack(top,1)=key_i+1
                   top=top+1
                   finded=TRUE
                end if
             next
             if finded=FALSE then
                for k=0 to childSet.length-1
                   set child=childSet.item(k)
                   set stack(top,0)=child
                   stack(top,1)=key_i
                   top=top+1
                next
             end if
            end if
         wend
         %>


                             </p>
                        </form>
                      <p>
                        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="144" height="39">
                          <param name="movie" value="button3.swf">
                          <param name="quality" value="high">
                          <param name="base" value=".">
                          <param name="bgcolor" value="#006666">
                          <embed src="button3.swf" width="144" height="39" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#006666"></embed>
                        </object>
                      </p>
                    </div></td>
                    
                </tr>
                <tr>
                  <td height="36" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="383" height="26" valign="top">   <font color="#66FFFF" size="4">      </font></td>
                        <td width="151" valign="top"><div align="center"><a href="main.htm"><font color="#33FFFF">返回</font></a></div></td>
                      </tr>
                    </table></td>
                </tr>
              </table>
            </div></td>
          <td width="2"></td>
        </tr>
      </TABLE>
    <CENTER>
      </DIV>
    </CENTER></BODY></HTML>


       收藏   分享  
    顶(1)
      




    ----------------------------------------------
    私人网站:蓝尚WEB商务平台http://www.lanshang.com     建站黄页:http://www.lanshang.com/link.asp WEB技术文库:http://www.lanshang.com/wenzhang/ 
    电子书籍: http://www.lanshang.com/ebook/  技术交流:http://www.lanshang.com/bbs/

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2004/5/20 3:03:00
     
     GoogleAdSense魔羯座1981-12-22
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 精华版 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/11/26 1:52:35

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

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    94.238ms