如何获取树节点的属性列表 [英] how to get the list of attributes of a tree node
本文介绍了如何获取树节点的属性列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取节点具有的属性列表,例如-
<ContentNode type="ApplicationProcess" name="Sub App Process2" navigate_url="" tag="c2532e51-704f-45e9-abc7-f8a2a7b1f425">
这里的属性是type
,name
,navigate_url
和标记,因此我需要在下拉列表中填充这些属性名称,因此任何人都可以建议可以做什么?
预先感谢,
Gokul
其实这是我要添加到我的应用程序中的一件事.我想根据所选节点将属性列表填充到下拉列表中,所以有人可以帮助我吗? class ="h2_lin">解决方案
将此方法有帮助吗? [ XmlAttributeCollection attrlst;
foreach(列表中的XmlNode n1)
{
字符串str = n1.Attributes ["name"].Value;
if(str == t)
{
attrlst = n1.Attributes;
foreach(attrlst中的XmlAttribute att)
{
字符串ite = att.Name;
drplst.Items.Add(ite);
}
}
}
Hi,
I want to get the list of attributes a node is having, for eg -
<ContentNode type="ApplicationProcess" name="Sub App Process2" navigate_url="" tag="c2532e51-704f-45e9-abc7-f8a2a7b1f425">
Here the attributes are type
, name
, navigate_url
and tag so I need to get these attribute names to be populated in a drop down, so can anyone suggest what can be done?
Thanks in advance,
Gokul
Actually this is a extra thing which i am adding to my application.I want to get the list of attributes to populated in a dropdown based on the node selected, so can anyone help me with that?
解决方案
Would this method help?[^]
XmlNodeList list = doc.SelectNodes("//*");
XmlAttributeCollection attrlst;
foreach (XmlNode n1 in list)
{
string str =n1.Attributes["name"].Value;
if(str==t)
{
attrlst = n1.Attributes;
foreach (XmlAttribute att in attrlst)
{
string ite = att.Name;
drplst.Items.Add(ite);
}
}
}
这篇关于如何获取树节点的属性列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文