I have created an XML document. What is the easiest/best way to read it in C# ?
I have created an XML document. What is the easiest/best way to read it in C# ? And if I want to create C# code from my xml whats the best way to do it without having to do it all by hand?
john doePosted Jul 3, 2012, 6:58 AM
hey mike, this kinda depends on what you want, you can try XmlTextReader to output the contents, or you could try XmlDocument class which is better if you want to play with the data. to generate your c# code from xml you can use something like liquid xml c# tool which will automatically create c# code based on your xml or schema file, is that what you were after?
Jignesh TrivediPosted Jul 3, 2012, 12:16 AM
If you use .net framework 3.5 and above then it is better to use LINQ to XML else use data.ReadXML method for .net 2.0 and blow.
please refer
http://www.codeproject.com/Articles/24376/LINQ-to-XML
http://support.microsoft.com/kb/311566
hope this will help you.
VulpesPosted Jul 2, 2012, 9:29 AM
Here's a list of articles we have on the subject. The five part one by Dhananjay is particularly good:
http://www.c-sharpcorner.com/tags/linq+to+xml
Manikavelu VelayuthamPosted Jul 2, 2012, 9:22 AM