XmlDocument加载功能为大型XML文件提供了内存不足异常(135mb) [英] XmlDocument load function is giving Out of Memory Exception For large XML file(135mb)

查看:347
本文介绍了XmlDocument加载功能为大型XML文件提供了内存不足异常(135mb)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


XmlDocument xmlDom = new XmlDocument();
xmlDom.Load("D:\CPDCL_01HW342889_ALL_new.xml");


据我说,Innerxml的数据成员不能保存此大字符串数据,因为在加载XML时,它显示了内存异常之外的innerxml.

由于XML文件为135 MB,所以我们无法附加.因此,请让我知道如何加载大容量(135 MB).
XML文件.

谢谢
阿比(Abhi)

============================

错误消息显示如下,

InnerXml = Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation.


According to me Innerxml data member of XmlDocument can not able to hold this large string data, as its showing innerxml out of memmory exception, when we load the XML.

Since XML file is 135 MB, so we can not attach. So please let me know how to load the large (135 MB).
XML file.

Thanks
Abhi

==============================

The error message was showing as follows,

InnerXml = Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation.

推荐答案

您是否尝试过使用linq使用xelement.load将其加载到XML?我相信这比xmldocument的占用空间小,尽管我对此可能是错的.

Derek
Have you tried loading it using linq to XML using xelement.load ? I believe it''s a smaller foot print the xmldocument, although I could be wrong on that.

Derek


尝试将其转换为流,然后加载到XMLDocument中.

Try to convert it to stream and then load in XMLDocument.

FileStream filestream = File.OpenRead(pathtofile); 
XMLDocument objDOM = new XMLDocument();
objDOM.Load(filestream)


不,我们应该只使用xmldocument对象.

-阿比(Abhi)
no, we should use xmldocument object only.

-Abhi


这篇关于XmlDocument加载功能为大型XML文件提供了内存不足异常(135mb)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆