从xml存储特定的节点 [英] store specific nodes from xml
本文介绍了从xml存储特定的节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想知道如何在数据集中存储特定节点.
我在xml文件中有四个节点.我希望只有一个节点存储在数据集中.
请帮助我.
感谢
hi guys,
i want to know how can i store a specific node in dataset.
i have four nodes in xml file. i want a only one node is stored in dataset.
please help me in this.
thanks
推荐答案
尝试一下
Try this
XmlDocument doc = new XmlDocument();
doc.LoadXml(upXml);//upXML is a string variable containing XML
var fnode = doc.GetElementsByTagName("name")[0];//Getting specific node name(it is more than 1 so we are using 0th positioned node
var fval = fnode.Attributes["ab"].Value;//accessing node''s attribute ab
这篇关于从xml存储特定的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文