XML Parsing in C#

One of the things I keep coming back to time and again is how to parse XML in C#. Apparently there are 3 different ways :

[1] XmlDocument

[2] XmlReaders

[3]  LINQ2XML or XLINQ for short  (recommended)

#3  is apparently the recommended approach, given its simplicity.

I tried giving it a shot.  It turns out its really quite simple after all. I could read an XML and parse it in memory, and add elements to it, in pretty quick time.

Code:

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s