Seeking in a huge xml file?

  • Thread starter Thread starter Yexiong Feng
  • Start date Start date
Y

Yexiong Feng

Hello all,

The problem I am trying to solve is that, given a huge xml file (say, 2 GB),
I wan to seek to a random position, and then starting reading the content
from the closest 2nd level node after the seek position.

Anyone knows how to do this?

Thanks!
Feng
 
Yexiong said:
The problem I am trying to solve is that, given a huge xml file (say, 2 GB),
I wan to seek to a random position, and then starting reading the content
from the closest 2nd level node after the seek position.

Anyone knows how to do this?

Use XmlReader. Once you have found a node you can then perhaps do
ReadSubtree() to pass a reader focussed on that node to higher level
APIs like XmlDocument or XPathDocument or XDocument (in .NET 3.5).
 
Generaly speaking, how long does it take to parse an 2GB XML file on te file
system compared to getting data out of a table in 2GB SQL Server database?
 
Back
Top