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?
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).