XML construction in C#
Currently i need to construct and update large xml files. So what is the best C开发者_StackOverflow社区# xml parser to create or update the xml files? I heard about LINQ in c#, can this be used?
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.
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
You can use SAX to parse large xml files; and XDocument
to maintain xml file.
精彩评论