With more and more data being stored in XML, web applications today commonly need some way to view and edit the data stored in an XML file from a web
page interface. If the XML data is relatively "flat" and tabular in nature, we can use data Web controls like the DataGrid, GridView, and Repeater. (See Quickly
Editing XML Data for an example of editing XML data through a DataGrid control.) But what if the XML data is more hierarchical and in a less tabular
format? Consider a company-wide phone book, which is recursively structured into branches and departments, subdepartments, and so forth. How can this XML
data, which can have any number of nodes and any level of children, be displayed and edited through a web page?
In this article we will build a web page that displays the contents of a company-wide phone book whose information is encoded in an XML file. The page
will recursively display the phone book XML data using a TreeView to list the branches and departments and a ListView to enumerate the employees that
belong to the selected branch or department. In particular, the ListView will display the employees that belong to the selected branch or department
as well as all the employees that belong to any subdepartments. (In a future article we will look at how to extend the ListView to enable the user
to add, edit, and delete phone book entries.)
Read on to learn more!
Read More >