You typically use a database to save data, but you can also use an XML file to save data. Suppose the contents of the XML file are:
Test.xml
<?xml version= "1.0" encoding= "gb2312"?>
<site>
<root>
<list>
<id>0</id>
<name> Sina </name>
<url>http://www.sina.com.cn</url>
<time>2007-11-1 10:10:10</time>
</list>
<list>
<id>1</id>
<name>google</name>
<url>http://www.google.cn</url>
<time>2007-11-2 11:11:11</time>
</list>
</root>
</site>
ASP file to display the content in the XML
Index.asp
<style>
body {font-size:12px;}
</style>
<%
strSourceFile = Server.MapPath ("./") & "\test.xml"
' Get the path to the XML file, which is different depending on your virtual directory.
Set objxml = Server.CreateObject ("Microsoft.FreeThreadedXMLDOM")
' Create an XML pair as a free thread
Objxml.load (strsourcefile) ' reads the XML file into memory
Set objrootsite = ObjXML.documentElement.selectSingleNode ("root")
' Select the root node
Num=objrootsite.childnodes.length-1
For i=0 to Num
Response.Write "Site Name:" &objrootsite.childnodes.item (i) Childnodes.item (1) .text& "<a href=" "javascript: Delxml ("&objrootsite.childnodes.item (i). Childnodes.item (0) .text&") "" > Delete </a> <a href= "" Editxml.asp?id= "&objrootsite.childnodes.item (i) childnodes.item (0) .text&" "> Modify </a>
"
Response.Write "URL:" &objrootsite.childnodes.item (i) Childnodes.item (2) .text& "
"
Response.Write "Add Time:" &objrootsite.childnodes.item (i) Childnodes.item (3) .text& "
"
Next
%>
<script>
function Delxml (ID)
{
if (!confirm) are you sure you want to delete it? ")) return false;
location.href= ' delxml.asp?id= ' +id;
}
</script>
Note: index.asp to be placed in the same directory as the Test.xml file.