Jump to content

Random access to large XML documents


Trekstuff

Recommended Posts

Hi,I need to have random access to the XML document, selecting children may depend of what parents are and vice versa, need to be able to go from deeper level back to ancestors etc. So naturally XPath (and - I am using .NET - XPathDocument and XPathNavigator) are the tools of choice. The problem is - how to deal with large files? Entire document has to be loaded in memory and for files over 50Mb "out of memory" error is guaranteed.Any idea how to have random access to large XML documents?Thanks,Yuriy.

Link to comment
Share on other sites

You'll either have to keep your files small or use a streaming based API which will react on XML nodes as a series of events.Such processors don't keep the whole tree in memory, but only the node(s) they are currently processing. Navigating in the tree with such APIs though is to put it mildly - hard. As for something random, that has always been the job of other functions in the environment to provide. And how exactly is the API going to let you use the generated number is another question.And the final question of course - which API to use. I haven't used .NET so I can't really say for sure, but I think xmlReader is it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...