content.xml内容如下:
<?xml version="1.0" encoding="utf-8" ?> 
- <chat>
  <msg>聊天内容</msg> 
- <Info>
  <id>158242347</id> 
  <user>[aa]</user> 
  <sex>boy</sex> 
  <ip>127.0.0.1</ip> 
  <userInTime>2007-8-14 17:11:04</userInTime> 
  </Info>
- <Info>
  <id>158242348</id> 
  <user>[bb]</user> 
  <sex>girl</sex> 
  <ip>127.0.0.1</ip> 
  <userInTime>2007-8-14 17:11:09</userInTime> 
  </Info>
- <Info>
  <id>158242349</id> 
  <user>[cc]</user> 
  <sex>boy</sex> 
  <ip>127.0.0.1</ip> 
  <userInTime>2007-8-14 17:11:14</userInTime> 
  </Info>
  </chat>
asp中的程序如下:
set xmldoc=server.CreateObject("MSXML.DOMDocument")
xmldoc.load(server.MapPath("content.xml"))
set root=xmldoc.documentElement          '获取根节点
for i=1 to root.childNodes.length-1
    if root.childNodes(i).childNodes(1).childNodes(0).text = "[aa]" then
root.childNodes(i).childNodes(4).childNodes(0).Text=now()
exit for
   end if
next
//不知道为什么,单独执行上面的程序正常,单独执行下面的程序也正常,但是如果把上面的和下面的放在同一个页面代码中,则会经过大约3分钟才能把这几行代码执行完毕,
不知道哪里出了问题了,请大家帮忙看一下.
i=1
L= root.childNodes.length-1
do while  i<=L
if DateDiff("s",(root.childNodes(i).childNodes(4).childNodes(0).Text),now()) > 10  then
root.removeChild(root.childNodes(i))
if L = root.childNodes.length-1 then
i=i+1
else
i=1
         L=root.childNodes.length-1
end if
end if
loop
xmldoc.save(server.MapPath("content.xml")) '写完数据之后保存文档