Parsing XML file using C#?

前端 未结 3 1318
故里飘歌
故里飘歌 2021-02-04 10:06

I\'m new to both XML and C#; I\'m trying to find a way to efficiently parse a given xml file to retrieve relevant numerical values, base on the \"proj_title\" value=heat_run or

3条回答
  •  滥情空心
    2021-02-04 10:32

    Use XDocument and use the LINQ api. http://msdn.microsoft.com/en-us/library/bb387098.aspx

    If the performance is not what you expect after trying it, you have to look for a sax parser. A Sax parser will not load the whole document in memory and try to apply an xpath expression on everything in memory. It works more in an event driven approach and in some cases this can be a lot faster and does not use as much memory.

    There are probably sax parsers for .NET around there, haven't used them myself for .NET but I did for C++.

提交回复
热议问题