如何调用原来已有的xml,寻找到节点并插入数据?

Amphibian 2003-06-28 08:02:24
http://www.csdn.net/Develop/Read_Article.asp?Id=4055

我是根据孟子E章的这篇文章做的,但是他那个例子只能录入一条记录,如果我要连续多个记录输入,该如何做?初学xml,且任务紧迫,请多指点。最好帮忙写出代码。
...全文
24 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
孟子E章 2003-07-11
  • 打赏
  • 举报
回复
多条记录可以在客户端生成
xml格式的字符串,提交后yong用xmldom解析,添加即可
saucer 2003-07-10
  • 打赏
  • 举报
回复
it sends the xml to the server side in a hidden control
bluedesign 2003-07-10
  • 打赏
  • 举报
回复
<input type="submit" onclick="hid.value=xmldoc.xml">
这句有什么意义呀,
如何将新添加的记录却不能被保存下来呀!
saucer 2003-06-28
  • 打赏
  • 举报
回复
there are many ways to do that, here is a way using xml data island, you can enter multiple records and submit once you are done:


<xml id="xmldoc"><books>
<book>
<author>John Smith</author>
<title>hello world</title>
</book>
<book>
<author>Tim Bray</author>
<title>whatever</title>
</book>
</books>
</xml>

<table border="1" cellspacing="0" cellpadding="0" datasrc="#xmldoc">
<thead><th>Author Name</th><th>Title</th></thead>
<tr>
<td><span datafld="author"></span></td>
<td><span datafld="title"></span></td>
</tr>
</table>

Name:<input type="text" name="txtName"><br>
Title:<input type="text" name="txtTitle"><br>

<input type="button" value="add" onclick="addNewAuthor()">

<script language"javascript">
function addNewAuthor()
{
xmldoc.recordset.addNew();
xmldoc.recordset("author") = txtName.value;
xmldoc.recordset("title") = txtName.value;
}
</script>

<form name="form1">
<input type="hidden" name="hid">
<input type="submit" onclick="hid.value=xmldoc.xml">
</form>

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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