Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading Dynamic XML Files In To A Tree View Web Server Control

Status
Not open for further replies.

Jo_Miracle

Technical User
Apr 6, 2018
1
IN
I am a newbie in programming and I'm trying to display metadata of some files using C#.Net.It is a web application intended to be hosted on our office intranet. I have been using Visual Studio 2017 with .NET framework version 4.6.1.

I have created several xml files for meta data and placed a TreeView web server control in my design page.Can you please tell me a way to populate the TreeView control from the xml files. A sample xml code is given below.

XML:
<?xml version="1.0" encoding="utf-8"?>  
<metadata>  
<idinfo>  
<citation>  
<citeinfo>  
<origin>Jay Diffendorfer</origin>  
<origin>Roger Compton</origin>  
<origin>Louisa Kramer</origin>  
<origin>Zach Ancona</origin>  
<origin>Donna Norton</origin>  
<pubdate>201402</pubdate>  
<title>Onshore Industrial Wind Turbine Locations for the United States through July 2013</title>  
<geoform>Maps and Data - vector digital data</geoform>  
<pubinfo>  
<pubplace>Denver, CO</pubplace>  
<publish>United States Geological Survey (USGS)</publish>  
</pubinfo>  
<onlink>[URL unfurl="true"]http://dx.doi.org/10.3133/ds817[/URL] and[URL unfurl="true"]http://eerscmap.er.usgs.gov/windfarm/</onlink>[/URL]  
</citeinfo>  
</citation>  
</idinfo>  
</metadata>

The above xml should be displayed as a tree strcture as :


Identification Information:
Citation:
Citation Information:
Originator: Jay Diffendorfer
Originator: Roger Compton
Originator: Louisa Kramer
Originator: Zach Ancona
Originator: Donna Norton
Published Date: 2014 02
Title: Onshore Industrial Wind Turbine Locations for the United States through July 2013
Geoform:Maps and Data - vector digital data
Publication Information:
Published Place: Denver, CO
Published by: United States Geological Survey (USGS)
Online Link: and
 
Remember Google is your best friend as a programmer. Using a quick search I found this:

AND



The examples may not be exactly what you need, but they should get you started. The key is to read the XML file into an XmlDocument object. Also, some of the code may be in VB.NET but it can be easily converted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top