在ASP中如何删除XML节点?

ydwcowboy 2002-12-24 11:37:38
xmlDoc.load("c:\xml.xml")
set PersonList = xmlDoc.getElementsByTagName("Person")
response.write PersonList.length-1
for i=0 to PersonList.length-1
if PersonList.item(i).attributes(2).text = "杨大伟" then
'xmlDoc.documentElement.removeNode(true) ????
'response.write PersonList.item(i).attributes(2).text
'在这里,如果满足条件就删除它????但我不知道如何写>?
end if
next
...全文
32 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunmingdong 2002-12-24
  • 打赏
  • 举报
回复
PersonList.removeChild PersonList.item(i)
sunmingdong 2002-12-24
  • 打赏
  • 举报
回复
a.loadXML "<Proot><Person cate='3' name='ChenYiQi' text='陈益其'/><Person cate='3' name='YeChunYan' text='叶春艳'/><Person cate='3' name='ChengHongJiang' text='程洪江'/></Proot>"
For i = 0 To a.documentElement.childNodes.length - 1
If a.documentElement.childNodes(i).Attributes(1).Text = "ChenYiQi" Then
a.documentElement.removeChild a.documentElement.childNodes(i)
Exit For
End If
Next
Go_Rush 2002-12-24
  • 打赏
  • 举报
回复
if PersonList.item(i).attributes(2).text = "杨大伟" then
PersonList.item(i).removeNode(true)
end if

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧