与其在更新单个元素时重写 xml 文件的全部内容,还有更新文件的更好替代方法吗?
最佳答案
我建议使用 VTD-XML http://vtd-xml.sourceforge.net/
来自他们的常见问题 (http://vtd-xml.sourceforge.net/faq.html):
Why should I use VTD-XML for large XML files?
For numerous reasons summarized below:
- 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.
In order to take advantage of VTD-XML, we recommended that developers split their ultra large XML documents into smaller, more manageable chucks (<2GB).
关于java - 如何更新大型 XML 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62423/