<p>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?</p>

[{'answer_id': 62460, 'author': 'Peter', 'author_id': 6094, 'author_profile': 'https://Stackoverflow.com/users/6094', 'pm_score': 3, 'selected': False, 'text': '<p>I would recommend using VTD-XML <a href="http://vtd-xml.sourceforge.net/" rel="noreferrer">http://vtd-xml.sourceforge.net/</a></p>\n\n<p>From their FAQ ( <a href="http://vtd-xml.sourceforge.net/faq.html" rel="noreferrer">http://vtd-xml.sourceforge.net/faq.html</a> ):</p>\n\n<blockquote>\n  <p>Why should I use VTD-XML for large XML files?</p>\n  \n  <p>For numerous reasons summarized below:</p>\n  \n  <ul>\n  <li>Performance: The performance of VTD-XML is far better than SAX</li>\n  <li>Ease to use: Random access combined with XPath makes application easy to write</li>\n  <li>Better maintainability: App code is shorter and simpler to understand.</li>\n  <li>Incremental update: Occasional, small changes become very efficient.</li>\n  <li>Indexing: Pre-parsed form of XML will further boost processing performance.</li>\n  <li>Other features: Cut, paste, split and assemble XML documents is only possible with VTD-XML.</li>\n  </ul>\n  \n  <p>In order to take advantage of VTD-XML, we recommended that developers split their ultra large XML documents into smaller, more manageable  chucks (&lt;2GB). </p>\n</blockquote>\n'}, {'answer_id': 62480, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>You have a few options here, but none of them are good. </p>\n\n<p>Since XML Objects aren't broken into distinct parts, you'll either have to use some filesystem level modification with regex pattern matching (sed is a good start), OR you should break your xml into smaller parts for manageability.</p>\n"}, {'answer_id': 62541, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>If possible, serialize the XML and use diff/patch/apply Linux tools (or equivalent tools in your platform) . This way, you don't have to deal with parsing, writing. </p>\n"}, {'answer_id': 64650, 'author': 'davetron5000', 'author_id': 3029, 'author_profile': 'https://Stackoverflow.com/users/3029', 'pm_score': 2, 'selected': False, 'text': "<p>If your XML file is so large that updating it is a performance bottleneck, you should consider moving away from XML to a more efficient disk format (or a real database).  </p>\n\n<p>If, however, you just <em>feel</em> like it might be a problem, remember the rules of optimization:</p>\n\n<ol>\n<li>Don't do it</li>\n<li>(experts only) Don't do it, yet.</li>\n</ol>\n"}, {'answer_id': 114810, 'author': 'Siddharth Gaur', 'author_id': 18863, 'author_profile': 'https://Stackoverflow.com/users/18863', 'pm_score': -1, 'selected': False, 'text': '<p><strong>Process Large XML Files with XQuery Works with Gigabyte Size XML Files</strong>\n<a href="http://www.xquery.com" rel="nofollow noreferrer">http://www.xquery.com</a></p>\n\n<p>XQuery is a query language that was designed as a native XML query language. Because most types of data can be represented as XML, XQuery can also be used to query other types of data. For example, XQuery can be used to query relational data using an XML view of a relational database. This is important because many Internet applications need to integrate information from multiple sources, including data found in web messages, relational data, and various XML sources. XQuery was specifically designed for this kind of data integration.</p>\n\n<p>For example, suppose your company is a financial institution that needs to produce reports of stock holdings for each client. A client requests a report with a Simple Object Access Protocol (SOAP) message, which is represented in XML. In most businesses, the stock holdings data is stored in multiple relational databases, such as Oracle, Microsoft SQL Server, or DB2. XQuery can query both the SOAP message and the relational databases, creating a report in XML.</p>\n\n<p>XQuery is based on the structure of XML and leverages that structure to make it possible to perform queries on any type of data that can be represented as XML, including relational data. In addition, XQuery API for Java (XQJ) lets your queries run in any environment that supports the J2EE platform.</p>\n'}]
['https://Stackoverflow.com/questions/62423', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']