執行個體演練ASP+XML編程(4)

來源:互聯網
上載者:User
五、程式首頁(default.asp)
??調用相應的包含檔案和公用函數,格式化XML檔案,並進行顯示。可以看到,頁面Title是可定製的,公用的頭部和尾部都做成了相應的包含檔案。C_TITLE、C_XMLFILE和C_XSLFILE為公用常量,在constpub.asp檔案中定義,至於它們的意義,相信讀者可以很容易地明白。這裡調用了上面定義的FormatXml函數。
<% Option Explicit
'***********************************************
' 說明:通訊錄
' 作者:gwd 2002-11-05
'***********************************************
%>
<!--#include file="pub/funcxml.asp"-->
<!--#include file="pub/constpub.asp"-->
<HTML>
<HEAD>
<TITLE><% = C_TITLE %></TITLE>
<META HTTP-EQUIV="content-type" CONTENT="text/html;charset=GB2312"/>
<link rel="stylesheet" href="contact.css" type="text/css">
</HEAD>
<BODY>
<!--#include file="pub/header.asp"-->
<% = FormatXml(C_XMLFILE, C_XSLFILE) %>
<br>
<!--#include file="pub/footer.asp"-->
</BODY>
</HTML>

  六、添加、修改和刪除XML中的資訊
??我們知道,在Cls_Person中已經定義了相應的方法,因此,在各個檔案中,只需要調用對應的方法即可。添加資訊的檔案為add.asp,修改資訊的檔案為edit.asp,刪除資訊的檔案為delete.asp,我們僅以add.asp檔案為例進行說明。其中的CheckStrInput和CheckStrOutput函數,用來格式化使用者的輸入和輸出字串。
<% Option Explicit
'***********************************************
' 說明:37080308通訊錄
' 作者:gwd 2002-11-05
'***********************************************
%>
<!--#include file="pub/funcxml.asp"-->
<!--#include file="pub/constpub.asp"-->
<!--#include file="pub/funcpub.asp"-->
<!--#include file="pub/class/clsPerson.asp"-->
<%
 Dim objXml, objPerson
 Dim strErr
 Set objXml = Server.CreateObject("MSXML2.DOMDocument")
 Set objPerson = New Cls_Person ' 產生Cls_Person對象

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.