-2

I'm reading the icecat sheets as one giant xml document (1.7g) and i'm using xmlnodereader.

How do I read it node by node. I know, normally, you wouldn't do this but the structure looks like

<file attr=value>...</file>


<file attr=value>...</file>


<file attr=value>...</file>


<file attr=value>...</file>


<file attr=value>...</file>

here is some existing code for reference:

 foreach (BackgroundWorker worker in Pool)
            {
                if (worker.IsBusy)
                    continue;
                //read xmlnode and pass it to the worker

            }
Arian
  • 325
  • 1
  • 15

1 Answers1

1

I would suggest using LINQ to XML if you can. You can use:

XElement element = XElement.Load(reader);

which will just load a single element from the reader, advancing it appropriate. It's really easy to do, and the LINQ to XML API is much nicer than the old DOM API.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194