如何更新大型XML文件 [英] How to update large XML file

查看:136
本文介绍了如何更新大型XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在更新单个元素时,是否有更好的替代方法来更新文件,而不是重写xml文件的全部内容?

Rather than rewriting the entire contents of an xml file when a single element is updated, is there a better alternative to updating the file?

推荐答案

我建议使用VTD-XML http://vtd-xml.sourceforge.net/

I would recommend using VTD-XML http://vtd-xml.sourceforge.net/

来自他们的常见问题解答( http: //vtd-xml.sourceforge.net/faq.html ):

From their FAQ ( http://vtd-xml.sourceforge.net/faq.html ):


为什么我要将VTD-XML用于大型XML文件?

Why should I use VTD-XML for large XML files?

由于以下概述的众多原因:

For numerous reasons summarized below:


  • 性能:性能VTD-XML比SAX好得多

  • 易于使用:随机访问与XPath结合使应用程序易于编写

  • 更好的可维护性:应用程序代码更短更容易理解。

  • 增量更新:偶尔,小的变化变得非常有效。

  • 索引:预解析的XML形式将进一步提高处理性能。

  • 其他功能:只能使用VTD-XML剪切,粘贴,拆分和汇编XML文档。

  • Performance: The performance of VTD-XML is far better than SAX
  • Ease to use: Random access combined with XPath makes application easy to write
  • Better maintainability: App code is shorter and simpler to understand.
  • Incremental update: Occasional, small changes become very efficient.
  • Indexing: Pre-parsed form of XML will further boost processing performance.
  • Other features: Cut, paste, split and assemble XML documents is only possible with VTD-XML.

为了利用VTD-XML,我们建议开发人员将超大型XML文档拆分为更小,更易管理的卡盘(<2GB)。

In order to take advantage of VTD-XML, we recommended that developers split their ultra large XML documents into smaller, more manageable chucks (<2GB).

这篇关于如何更新大型XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆