• <bdo id='f7tC3'></bdo><ul id='f7tC3'></ul>
      <i id='f7tC3'><tr id='f7tC3'><dt id='f7tC3'><q id='f7tC3'><span id='f7tC3'><b id='f7tC3'><form id='f7tC3'><ins id='f7tC3'></ins><ul id='f7tC3'></ul><sub id='f7tC3'></sub></form><legend id='f7tC3'></legend><bdo id='f7tC3'><pre id='f7tC3'><center id='f7tC3'></center></pre></bdo></b><th id='f7tC3'></th></span></q></dt></tr></i><div id='f7tC3'><tfoot id='f7tC3'></tfoot><dl id='f7tC3'><fieldset id='f7tC3'></fieldset></dl></div>
      <tfoot id='f7tC3'></tfoot>

      1. <legend id='f7tC3'><style id='f7tC3'><dir id='f7tC3'><q id='f7tC3'></q></dir></style></legend>
      2. <small id='f7tC3'></small><noframes id='f7tC3'>

        在 .net 中读取大型 XML 文档

        时间:2023-08-28

        <small id='pk2B4'></small><noframes id='pk2B4'>

      3. <legend id='pk2B4'><style id='pk2B4'><dir id='pk2B4'><q id='pk2B4'></q></dir></style></legend>

            <tfoot id='pk2B4'></tfoot>
            • <bdo id='pk2B4'></bdo><ul id='pk2B4'></ul>
            • <i id='pk2B4'><tr id='pk2B4'><dt id='pk2B4'><q id='pk2B4'><span id='pk2B4'><b id='pk2B4'><form id='pk2B4'><ins id='pk2B4'></ins><ul id='pk2B4'></ul><sub id='pk2B4'></sub></form><legend id='pk2B4'></legend><bdo id='pk2B4'><pre id='pk2B4'><center id='pk2B4'></center></pre></bdo></b><th id='pk2B4'></th></span></q></dt></tr></i><div id='pk2B4'><tfoot id='pk2B4'></tfoot><dl id='pk2B4'><fieldset id='pk2B4'></fieldset></dl></div>

                <tbody id='pk2B4'></tbody>
                  本文介绍了在 .net 中读取大型 XML 文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我需要使用 .net 文件读取大型 xml,这些文件的大小很容易达到几 GB.

                  I need to read large xml using .net files which can easily be several GB of size.

                  我尝试使用 XDocument,但是当我尝试加载文档时它只是抛出 System.OutOfMemoryException.

                  I tried to use XDocument, but it just throws an System.OutOfMemoryException when I try to load the document.

                  读取大尺寸 XML 文件的最佳方式是什么?

                  What is the most performant way to read XML files of large size?

                  推荐答案

                  你基本上在这里使用拉"模型 - XmlReader 和朋友.这将允许您流式传输文档,而不是一次性将其全部加载到内存中.

                  You basically have to use the "pull" model here - XmlReader and friends. That will allow you to stream the document rather than loading it all into memory in one go.

                  请注意,如果您知道自己处于足够小"元素的开头,则可以创建一个 XElement 来自 XmlReader,使用 LINQ to XML 的荣耀处理它,然后移动到下一个元素.

                  Note that if you know that you're at the start of a "small enough" element, you can create an XElement from an XmlReader, deal with that using the glory of LINQ to XML, and then move onto the next element.

                  这篇关于在 .net 中读取大型 XML 文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何使用 C#/LINQ 将 XML 转换为 JSON? 下一篇:读取 XML(从字符串)并获取一些字段 - 读取 XML 时出

                  相关文章

                  最新文章

                      <i id='Pcker'><tr id='Pcker'><dt id='Pcker'><q id='Pcker'><span id='Pcker'><b id='Pcker'><form id='Pcker'><ins id='Pcker'></ins><ul id='Pcker'></ul><sub id='Pcker'></sub></form><legend id='Pcker'></legend><bdo id='Pcker'><pre id='Pcker'><center id='Pcker'></center></pre></bdo></b><th id='Pcker'></th></span></q></dt></tr></i><div id='Pcker'><tfoot id='Pcker'></tfoot><dl id='Pcker'><fieldset id='Pcker'></fieldset></dl></div>
                    1. <tfoot id='Pcker'></tfoot>
                      <legend id='Pcker'><style id='Pcker'><dir id='Pcker'><q id='Pcker'></q></dir></style></legend>
                        <bdo id='Pcker'></bdo><ul id='Pcker'></ul>
                    2. <small id='Pcker'></small><noframes id='Pcker'>