.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Easy and best way to parse xml file? note the file is too large

Posted By: shankey     Posted Date: May 17, 2011    Points:5   Category :C#
hi all, i have a large xml file and i want to parse this file but the file parsing should be quick.
The code should be in c#

Please help me..

<xx>
<x1>xxxxxxx</x1>
<x2>BB</x2>
<x3 Unit="min">0.747087</x3>
</xx>


Responses
Author: Maverick          Accepted Answer   
Posted Date: May 17, 2011     Points: 40   

Hello,
Use the code below

string path = Server.MapPath("Your.xml");
XDocument xmlDoc = XDocument.Load(path);

var xmldata= from c in xmlDoc.Descendants("xx")
select new
{
x1= c.Element("x1").Value,
x2= c.Element("x2").Value,
x3= c.Element("x3").Value,
};
foreach (var c in xmldata)
{
string x1 = xx.x1;
string x2 = xx.x2;
string x3 = xx.x3;
}

Hope it helps.

Thanks,
Maverick
Author: VinayMandavilli             
Posted Date: May 18, 2011     Points: 20   

Good One...



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend