In ASP.NET XML Files can be used as data source. one can use XML(Extensible Markup Language) file to store data, and can use it to access data without using database. XML is supported in all applications. So, it is used widely in ASP.NET and can use DataSet to use this XML file.
Let’s create one XML file, named “test.xml” like below.
[html] <?xml version="1.0" encoding="utf-8" ?>
<technologies>
<technology>
<text>ASP.NET</text>
<value>A</value>
</technology>
<technology>
<text>JAVA</text>
<value>J</value>
</technology>
<technology>
<text>HTML</text>
<value>H</value>
</technology>
</technologies>
[/html]
Alternative
forms
If one want to use this XML file as data source, have to add “System.Data” namespace to their code behind page of design page (here it is “default.aspx.cs”).
In the below example, added one RadioButtonList on a page, which will be populated with the data provided by the XML file. Here, the XML file “test.xml” is used as data source.
At design page, it is provided with one radio button.
At code behind page we have added “System.Data” namespace and used one data set, where the data source is the “test.xml” file and have bound the RadioButtonList with this data source.
When viewed in browser the RadioButtonList list will appear with the data provided in the “test.xml” file.