Now for a basic example of XUpdate. For more in-depth information on XUpdate check out the specification at www.xmldb.org/xupdate/xupdate-wd.html
. An XUpdate XML document is a container of commands to be performed in series. Again, assume I want to update the following XML document.
<product product_id="1" type="widget">
<product product_id="2" type="widget">
<product product_id="3" type="widget">
If I want to remove product_id 2 and change the description of product_id 3 I would use the following XUpdate modification block.
<xu:modifications version="1.0" xmlns:xu="http://www.xmldb.org/xupdate">
As you can see, my XUpdate modification block is made up of two commands. The first removes product_id 2 and the second updates product_id 3. There are two main points to remember with XUpdate. First, the commands are performed serially (in the order they appear in the modification block). Second, the command is performed on the element represented by the select attribute, which is an XPath query. Thus it is possible to update multiple documents with specific changes in a single XUpdate modification block.
The final method deletes documents from the database.
Resource document = col.getResource(ID);
Having seen all of the most important features Xindice offers, you might agree that it is quite a complete native database implementation. Like many open source projects, Xindice continues to evolve. Two of the more interesting features that may appear in the next major release are versioning and auto-linking. Versioning would be quite a useful feature for developers who use Xindice for their XML configuration documents. Auto-linking on the other hand represents an interesting approach to data redundancy in XML documents. It has the potential to provide the power of relations without the rigid schema requirements found in traditional relational databases.