private void btnSubmit_Click(object sender
{
GetRss();
}
private void txtUrl_KeyDown(object sender
{
if (e
{
GetRss();
}
}
private void GetRss()
{
try
{
XElement doc = XElement
//使用LINQ檢索所有的節點
var els = from el in doc
select el;
appendtree(els
}
catch (Exception ex)
{
MessageBox
}
}
/**//// <summary>
/// 把XML節點上的值顯示在TreeView上
/// </summary>
/// <param name=
/// <param name=
/// <param name=
private void appendtree(IEnumerable<XElement> els
{
tnc
if (els
{
tnc
return;
}
foreach (var el in els)
{
TreeNode tn = new TreeNode(el
tn
tnc
}
}
private void tvdom_AfterExpand(object sender
{
if (e
{
XElement tnel = e
if (tnel != null)
{
//利用LINQ查詢節點
var els = from el in tnel
select el;
appendtree(els
}
}
}
private void tvdom_AfterSelect(object sender
{
e
}
From:http://tw.wingwit.com/Article/program/net/201311/11609.html