Groups | Blog | Home
all groups > dotnet xml > december 2005 >

dotnet xml : reading an xml file problem



adhag
12/5/2005 7:41:03 AM
Hi

I have an app that uses xpath to read an xml document. The problem is a
70meg file uses 1.5 gig of memory. What I really need is to read only chunks
of the file at a given time and cannot afford the overhead of reading in 1.5
gig of memory. A simplified example would be an xml file of 100 rows that I
wanted to return random chunks of records without reading in all 100 rows
each time. I would have a row number and a set number of rows to return.

Any help to solve this would be great.

Martin Honnen
12/5/2005 7:09:31 PM


[quoted text, click to view]


[quoted text, click to view]

Consider using XmlTextReader to parse the XML. That way the resources
processed do not depend on the file size as XPath reads the complete XML
into a tree model while XmlTextReader allows you to pull in the XML node
by node.

There is also this article
<http://msdn.microsoft.com/XML/BuildingXML/XMLColumns/default.aspx?pull=/library/en-us/dnexxml/html/xml05192004.asp>
which tries to combine XPath with an XmlReader.



--

Martin Honnen --- MVP XML
AddThis Social Bookmark Button