public void TreeViewToXml(TreeView treeView, String path)
{xmlDocument = new XmlDocument();
TreeNodeCollection nodes= null ;foreach (TreeNode treeNode in treeView.Nodes)
{
xmlDocument.AppendChild(xmlDocument.CreateElement(treeNode.Text));
nodes = treeNode.Nodes;}
XmlExport(xmlDocument.DocumentElement, nodes);
xmlDocument.Save(path);}
private XmlNode XmlExport(XmlNode nodeElement, TreeNodeCollection treeNodeCollection)
{XmlNode xmlNode = null;
foreach (TreeNode treeNode in treeNodeCollection)
{
xmlNode = xmlDocument.CreateElement(treeNode.Text);
string[] node = xmlNode.Name.Split(':');if (node[0] == "ATTRIBUTE")
{if (node[0] != null && node[1] != null)
{XmlAttribute newAttribute = xmlDocument.CreateAttribute(node[1]);
nodeElement.Attributes.Append(newAttribute);}
}
else
{if (nodeElement != null)nodeElement.AppendChild(xmlNode);
}
if (treeNode.Nodes.Count > 0)
{XmlExport(xmlNode, treeNode.Nodes);
}
}
return xmlNo

Sandeep PuvvadiPosted Apr 8, 2015, 1:25 AM
how to update the xml File with the changes which we made in treeview...
Nbl BzPosted Oct 23, 2014, 7:53 AM
Maybe is better with treeview exemple ?