EldoS | Feel safer!

Software components for data protection, secure storage and transfer

When loading large XML document, OutOfMemory error happens. How do I deal with it?

DOM XML parser supports two modes: normal and delay load. In normal mode the XML document is parsed and a XML DOM tree (node-tree) is created, after loading the source stream/file is not needed anymore as all data is stored in memory. In the delay load mode the xml document is parsed in the same way, but it is possible to specify what data type (comment, text, CDATA) not to store in the memory, the component will store its offset and size, and on each request to such node the data will be loaded and parsed from the source stream and then unloaded, so the source stream/file should not be closed until the XML document is freed/disposed.

The main usage of the delay load mode is to load XML documents with large data fields.

Sample usage:

XMLDocument.LoadFromStream(SourceStream, true, LoadNoData);
where LoadNoData is empty set of TElXMLDelayLoadMode type

Return to the list

|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!