-2

我正在将 icecat 表作为一个巨大的 xml 文档(1.7g)阅读,并且我正在使用 xmlnodereader。

如何逐个节点读取它。我知道,通常情况下,你不会这样做,但结构看起来像

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


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


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


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


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

这是一些现有的代码供参考:

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

            }
4

1 回答 1

1

如果可以的话,我建议使用 LINQ to XML。您可以使用:

XElement element = XElement.Load(reader);

它只会从阅读器中加载一个元素,并适当地推进它。这真的很容易做到,而且 LINQ to XML API 比旧的 DOM API 好得多。

于 2011-04-04T19:00:00.657 回答