Hello,
Here is my try to show all the Group elements and it subelements in a
tree view. I think something with the x-path implementation is wrong
because I don't see any result although there are such elements,could
you please tell me what is wrong?
The Code:
private void populateTreeControl(
System.Xml.XmlNode document,
System.Windows.Forms.TreeNodeCollection nodes)
{
XmlNodeList xmn = document.SelectNodes("/sectionGroup/*");
foreach (System.Xml.XmlNode node in
xmn)
{
string text = (node.Value != null ? node.Value :
(node.Attributes != null &&
node.Attributes.Count > 0) ?
node.Attributes[0].Value : node.Name);
TreeNode new_child = new TreeNode(text);
nodes.Add(new_child);
populateTreeControl(node, new_child.Nodes);
}
}
Thanks a lot!
*** Sent via Developersdex http://www.developersdex.com ***