I have tried to implement something what you want :
XmlTextReader rssReader = new XmlTextReader(Application.StartupPath + "\\Final.xml");
XmlDocument rssDoc = new XmlDocument();
rssDoc.Load(rssReader);
XmlNodeList nodeList = rssDoc.DocumentElement.ChildNodes;
foreach (XmlNode childNode in nodeList)
{
AddToListView(childNode);
}
private void AddToListView(XmlNode node)
{
if (node != null && node.Attributes!=null && node.Attributes.Count > 0)
{
ListViewItem lvi = new ListViewItem();
if (node.Attributes["name"] != null)
{
lvi.Text = node.Attributes["name"].Value;
}
if (node.Attributes["type"] != null)
{
lvi.SubItems.Add(node.Attributes["type"].Value);
}
else
{
if (node.ChildNodes != null && node.ChildNodes.Count > 0)
{
foreach (XmlNode vnode in node.ChildNodes)
{
if (vnode.Name == "value")
{
lvi.SubItems.Add(vnode.InnerText);
break;
}
}
}
}
listViewStaticVar.Items.Add(lvi);
}
if (!node.HasChildNodes)
return;
foreach (XmlNode chnode in node.ChildNodes)
{
AddToListView(chnode);
}
}