How to update large XML file

前端 未结 5 1373
难免孤独
难免孤独 2020-12-17 02:00

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?

5条回答
  •  渐次进展
    2020-12-17 02:36

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

    From their FAQ ( 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).

提交回复
热议问题