Read multiple sequential XML files in C # XmlReader

Possible duplicate:
Is there a built-in way to handle multiple files as a single stream?

I have a very large amount of sequential data split across multiple files. Using XmlDocument or LINQ is not an option as these files are huge and loading 500GB into memory is not an option .

Therefore I have to use XmlReader.

The files I have are fragmented in the XML sense, for example:

File 1:

...
<Person>
  <FirstName>John</FirstName>
  <LastName>Doe</LastName>

      

File 2:

  <Email>john@doe.com</Email>
</Person>
...

      

One possible solution is that I need a way to set up the stream, for example:

using (XmlReader reader = XmlReader.Create(stream)) { ... }

      

so the stream continuously feeds the XmlReader each file in sequence. Therefore, when the stream hits the end of the file, it automatically passes it to the next file. How can i do this? So for the XmlReader, it looks like it is just iterating over one big stream, but that stream consists of several sequential files?

Thank,

Allison

+3


source to share


1 answer


Linq to xml will feed on massive XML files for breakfast.



do you know http://msdn.microsoft.com/en-us/library/system.xml.linq.xnode.readfrom.aspx ?

0


source







All Articles