匹配asp.net中的xml节点 [英] match xml nodes in asp.net
本文介绍了匹配asp.net中的xml节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我在我的xml文件中有一个2节点,如:
hi guys,
i have a 2 node in my xml file like :
<1>
</1>
<2>
</2>
我希望当我单击按钮"1"上的单选列表时,一个子节点将添加1,如果我单击单选按钮"2"上,则将一个子节点添加到2.
我可以知道该怎么做吗?
XML格式的
i want when i click on a radiolist on button "1" a child node will add in a 1 and if i click on radiolist button "2" a child node will add in a 2.
can i know how can i do this?
XML formatted
推荐答案
引用链接
http://www.w3schools.com/dom/dom_nodes_add.asp [
Refer the link
http://www.w3schools.com/dom/dom_nodes_add.asp[^]
选择具有SelectSingleNode [ AppendChild [ ^ ]方法.
Select the node with SelectSingleNode[^] depending on your radiobutton selection and add child node using AppendChild[^] method.
您可以在JavaScript中进行此操作
You can do this in JavaScript
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);
to do this in C#
Check this[^]
这篇关于匹配asp.net中的xml节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文