populate dropdownlist from xml file

I have created a simple xml file that includes a small list of values to populate a dropdown list.  I can map to the xml file read the data in the xml file and bind it to the dropdownlist.

Here is my question.  I have a class library that I have created a dataset (.xsd) file with tableadapters that make calls to the database.

So, is there a way to add the dataset that pulls info from my xml file into the dataset in my class library?

I'm not sure how to do this?  I want to keep all the data extraction seperate from the application.  The way I have it now is the page code-behind:

protected void BindList()
        string path = MapPath("~/products.xml");
        DataSet dSet = new DataSet();

        chklst.DataSource = dSet;
        chklst.DataTextField = "name";
        chklst.DataValueField = "productid";

Is it possible to move the dataset portion into the class library?  If so, how?

Basically, what I'd like to have in the code-behind is the following:

GetEmployeeTableAdapter employee = new GetEmployeeTableAdapter();
ddlEmployee.DataSource = employee.GetEmployee();
ddlEmployee.DataTextField = "customer_id";
ddlEmployee.DataValueField = "recordID";
ddlEmployee.Items.Insert(0, new ListItem("Please select...", ""));

I just don't know how to create the dataset in the class library that reads from the xml.  The table adapters only seem to connect to a database.

Is what I want to accomplish possible?

Thanks for any help.
-Dman100-Software ConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sachintana DissanayakeSenior Web DeveloperCommented:
You can use xsd to class generation command line tool and it will generate .cs classes for your xsd.
     eg. xsd.exe "schemefile.xsd" /classes

If you are looking for a solution for your whole project, you can use nHibernate to map database objects to classes. It will automatically generate .net classes by accessing the database tables.
-Dman100-Software ConsultantAuthor Commented:
Hi sachintana,
Thanks for replying to my post.  My apologies, I got a little lost on your post.  I've never used the xsd to class generation tool

I might be misuderstanding, but after thinking about it further, can I not add a new class to my library project, add the xml file, create a method that creates the dataset and reads the xml data, recompile, add the reference to my web project and then simply call the method to bind the dropdownlist with the xml data?

I've heard about nHibernate, but have never used that either.  Does that work with xml files as well as databases?

Sorry for the novice questions.

I appreciate the help.  thank you.
Sachintana DissanayakeSenior Web DeveloperCommented:
I think you need to create a bounded Dataset, by looking at the XML file which is mapped to the existing .net classes. You need to keep the mapping in a XSD schema file. You can use the same xsd tool to generate the xsd schema from existing .net class library (dll or exe).
   xsd assemblyName.dll will generate a XSD schema.

In nHibernate, you have to define the database schema in a XML, not data.
But there;s another framework called ODX (Open Dataset eXtensions) - http://www.codeplex.com/odx
It supports XML data sources as well. I haven't use this, you need to research on this little more...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.