使用LINQ在C#中进行XML解析 [英] XML Parsing in C# using LINQ
问题描述
Hello Every One,
我正在尝试解析XML并根据匹配条件创建xmls的输出文件。然而,我能够写作 性能明智 - 代码太慢并且需要很长时间才能产生输出。
我正在使用XDocument + LINQ(用于learningLINQ)!!只是 想知道什么是最好的方法来处理巨大的xmls在尺寸和数量方面 - 任何建议/指针赞赏。
问候
您能否告诉我们至少一些关于XML输入外观的详细信息(结构和大小) ),你想要什么样的输出,你的LINQ到XML代码的外观,究竟是什么样的"花费多少时间"。是指(例如,分钟,小时,输入和输出的大小)?否则
很难提出建议。
有关如何处理大输入或输出的一些一般性建议可以在LINQ to XML文档中找到,请参阅
< a href ="http://msdn.microsoft.com/en-us/library/bb387008.aspx"> http://msdn.microsoft.com/en-us/library/bb387008.aspx 和
http://msdn.microsoft.com/en-us/library/bb387013.aspx一>
Hello Every One,
I am trying to parse XML and create xmls' out put files based on matching criteria. I was able to write , however, performance wise - code is tooo slow and taking ages to produce output.
I am using XDocument + LINQ ( for learningLINQ) !! Just wondering what is the best approach for handeling huge xmls both in terms of size and quantity - any suggestions / pointers appreciated.
Regards
Can you tell us some details at least as to how your XML input looks (structure and size), what kind of output you want, how your LINQ to XML code looks, what exactly "taking ages" means (e.g. minutes, hours, for what size of input and output)? Otherwise it is hard to make suggestions.
Some general suggestions on how to handle large input or output can be found in the LINQ to XML documentation, see http://msdn.microsoft.com/en-us/library/bb387008.aspx and http://msdn.microsoft.com/en-us/library/bb387013.aspx.
这篇关于使用LINQ在C#中进行XML解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!