Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

I have to read XML files from particular folder using c#.

Let me know the best way to read XML files from the folder.

Thanks in Advance.
Posted
Comments
Sinisa Hajnal 24-Nov-15 2:16am    
Use GetFiles method to get the list, loop through and do whatever you need with them. This shows surprising lack of effort from your part. My vote of 1
sanjay243657 24-Nov-15 4:08am    
Hi,

I have already tried using dataset.readxml
I have to find another way that why i ask that question.

1 solution

It impossible to answer your question with so little information.
What are you going to do with the data, for example.
Do the files have the same structure or are the they different?
If they are all the same, do you have a schema file?

In general terms you can use the DataSet[^] class and the method DataSet.ReadXml[^]
or you can use XmlDocument or XDocument.
Which is best for you is impossible to say.

To loop through the files in a folder you can use Directory.GetFiles[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900