Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Process xml without loading into memory

Tags:

c#

.net

xml

What is the best way to process XML if I can't afford to load the whole file into memory?

like image 354
SiberianGuy Avatar asked Sep 16 '25 20:09

SiberianGuy


2 Answers

Use an XmlReader and process element by element.

like image 199
Richard Schneider Avatar answered Sep 18 '25 18:09

Richard Schneider


You can use XmlReader class, it doesn't load the whole document into memory. Here you can find the complete list of ways to deal with XML with examples and pros and cons for every technology used.

like image 36
Dmitrii Lobanov Avatar answered Sep 18 '25 16:09

Dmitrii Lobanov