用XML文件绑定数据 [英] bind data with XML file
问题描述
我在xml文件中有一个父节点,在此文件中有四个子节点,名称分别为:A,B,C,D.而且我在1,2,3,4这样的aspx页面中也有一个单选按钮列表.当我单击单选按钮1时,它就是这样的一个节点
< parentnode>
< a>
< 1>
文字\\,这是来自文本框的文字.
</1>
</a>
< b>
</b>
< c>
</c>
< d>
</d>
</parentnode>
我该如何制作这种类型的xml文件.当我单击2时,它将在b节点中创建一个节点.
i have one parent node in xml file and four child node in this by the name of like : A,B,C,D. and i also have a radio buttonlist in aspx page like 1,2,3,4. when i click on radio button 1. then it a node in this like
<parentnode>
<a>
<1>
text \\ this is a text which is coming from a textbox.
</1>
</a>
<b>
</b>
<c>
</c>
<d>
</d>
</parentnode>
how can i made this type of xml file. when i click on 2 it make a node in b node. help me in this.
推荐答案
You can do this in JavaScript
Collapse | Copy Code
xmlDoc=loadXMLDoc("XML1.xml");//loading XML
newel=xmlDoc.createElement("node");//creating new node name node
x=xmlDoc.getElementsByTagName("Root Node")[0];//Appending the node to first root element
x.appendChild(newel);
请参阅此链接
http://www.w3schools.com/dom/dom_nodes_add.asp [
Refer this link
http://www.w3schools.com/dom/dom_nodes_add.asp[^]
这篇关于用XML文件绑定数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!