xml问题请教,

maolz21 2005-04-17 02:24:15
xml文件见此贴中,http://community.csdn.net/Expert/topic/3942/3942889.xml?temp=.6449701
想新添加domains下面domain的一条记录即
添加一条完整的
<domain id="1">
<url>www.xinweisolar.com</url>
<path>xinwei</path>
<isHidden>1</isHidden>
<title>ÐÀΰ̫ÑôÄÜ</title>
<memo>¶¡ÅÊ</memo>
<lastupdate/>
</domain>
但在使用insertBefore时出现问题,还请指点


dim id
Randomize
id=cint((rnd)*(9999-1000+1)+1000)
id=year(now())&","&month(now())&","&day(now())&","&hour(now())&","&minute(now())&","&second(now())&","&id
id=cstr(id)
dim newNode
set newNode=xmlDoc.createNode(1,"domain","")
newNode.setAttribute "id",id

set currNode=xmlDoc.insertBefore(newNode,xmlDoc.documentElement.childNodes.item(1).childNodes.item(0))

...全文
66 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
public function additemblogm(blogtitle,blogcontent,thelink,thefile)
set addroot=thexmldom.createElement("blog")
set root=thexmldom.documentElement
set currnode = root.insertBefore(addroot, root.childNodes(0))
currnode.setAttribute "date",date
currnode.setAttribute "time",time
set blogtitleadd=thexmldom.createElement("blogtitle")
set blogtitled=currnode.appendchild(blogtitleadd)
blogtitled.text=blogtitle
set blogcontentadd=thexmldom.createElement("blogcontent")
set blogcontentd=currnode.appendchild(blogcontentadd)
blogcontentd.text=blogcontent
set bloglinkadd=thexmldom.createElement("link")
set bloglinkd=currnode.appendchild(bloglinkadd)
bloglinkd.text=thelink
set blogcommentadd=thexmldom.createElement("comment")
currnode.appendchild blogcommentadd
thexmldom.save thefile
end function

newNode,xmlDoc.documentElement.childNodes.item(1).childNodes.item(0))------》childnodes(1).childnodes(0),这个是不要item的,insertbefore参考我写的

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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