大家好.请帮我看一下为什么是死循环啊/一点道理也没有啊?谢谢了.
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")) '写完数据之后保存文档
<?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")) '写完数据之后保存文档
...全文
相关推荐
js代码-帮忙看看这个代码为什么没有进入死循环
js代码-帮忙看看这个代码为什么没有进入死循环
这些道理没有人告诉过你
这些道理没有人告诉过你,电子书,作者:杨萃先
Shell实现程序造死循环的几种方法示例
在linux下编程的程序猿都知道shell脚本,就算你不怎么熟悉,也应该听过的吧!那在shell脚本中的死循环该怎么写呢?下面这篇文章就来给大家介绍了关于Shell如何实现让程序造死循环的几种方法,需要的朋友可以参考下。
一个简单的死循环事例
一个简单的死循环,初学者可以借鉴一下,还凑合。
解决vue-router路由拦截造成死循环问题
主要介绍了解决vue-router路由拦截造成死循环问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧


