Load XML data into treeview [modified]
-
Hi, Ok i have my XML file a generate in my application which holds account information. How can i populate only the "AccountName" field in a treeview? i tried and am struggling it doesnt populate correct. Im using VS2005 and this is a windows application. my xml file looks like this: 1 gmail me 1234 njun 3 codeproject me2 1234555 hhhhhhhh 8 myacc1 qwe 111 fgfg I only want the "AccountName" field to show in the treeview so when they click on it the rest of the data shows in labels. I have done this with a listbox but would like to use a treeview thanks alot guys hope you can help Regards
-
Hi, Ok i have my XML file a generate in my application which holds account information. How can i populate only the "AccountName" field in a treeview? i tried and am struggling it doesnt populate correct. Im using VS2005 and this is a windows application. my xml file looks like this: 1 gmail me 1234 njun 3 codeproject me2 1234555 hhhhhhhh 8 myacc1 qwe 111 fgfg I only want the "AccountName" field to show in the treeview so when they click on it the rest of the data shows in labels. I have done this with a listbox but would like to use a treeview thanks alot guys hope you can help Regards
Hi You can use xpath to query a specific node within a xml file. Open a xml file in a XmlDocument object (System.Xml namespace) and then you can get its elements using xpath.XmlDocument has some methods that you can use to query a xml file for example you can use SelectNodes or SelectSingleNode or GetElementsByTagName. You can use serialization to serialize and deserialize your xml file into an object model.You can use xsd utility to build this object model from your xml file the you can use XmlSerializer (System.Xml.Serialization namespace) to deserialize your xml file into your object model and use this object model to populate a treeview. Regards Nima