Thiyaneshwaran S
Thiyaneshwaran S

Reputation: 1135

XML construction in C#

Currently i need to construct and update large xml files. So what is the best C# xml parser to create or update the xml files? I heard about LINQ in c#, can this be used?

Upvotes: 4

Views: 224

Answers (3)

Kamran Khan
Kamran Khan

Reputation: 9986

You can use SAX to parse large xml files; and XDocument to maintain xml file.

Upvotes: 0

Lucero
Lucero

Reputation: 60190

For really large documents, you may want to use a plain XmlReader/XmlWriter pipelined approach, since this avoids loading the whole file into memory, which is the case with both XmlDocument DOM and LINQ-to-SQL.

Upvotes: 6

bakasan
bakasan

Reputation: 2302

The XML capabilities of LINQ to query through and work with large/complex data files is quite good, and better yet, XElement generally tends to be more performant than XmlDocument objects. Working via XElements also simplifies some of the traditional pains and verbose-ness of traditional XML handling, notably namespaces are a lot simpler to deal with.

MSDN reference on Linq to XML: http://msdn.microsoft.com/en-us/library/bb387098.aspx

Upvotes: 4

Related Questions