I need to be able to update XML in the Tamino database with some incoming XML. Because of multiplicity I am sending in an XPATH string so that I will know at what level to insert the new XML fragment.
As far as I can tell the only way I can do this in Tamino at this time is by pulling out the whole XML document, parsing it myself using XALAN’s XPathApi and then updating it in the database. The problem with this is my XML file is very very large. I’ve created my own update fuction that parses the Tamino XML result, inserts the update fragment at the correct location and then updates the database, but this whole process takes a long time.
I know about the appendChild function, but we do not want to put IIS on our system for security reasons.
Unfortunately, my whole project kind of centers around a need for this update functionality. Is there any possibility of Tamino adding an update with xpath fuction at some later date?
a) wait for Software AG to put this update functionality in the XML Server, which probably will take more time than you have,
b) write a server side update mechanism (that takes XPath arguments) and that does the document manipulation (perhaps by applying XSL-Ts). Have a look at XML DB’s XUpdate proposal, I think you could extend this to your needs and write some stylesheets that do the magic. With all the effort going into stylesheet processors like XALAN and SAXON and their respective Template Compilers, you might get enough performance to feel - well, not exactly happy, but okay.
Please keep us posted, I think this is of general interest.
Don’t forget that you can actually run Apache + IIS on the same box simultaneously. This is what I do in my test environment. I actually have Apache as my main Tamino web server (port 80) and just use IIS for NodeLevelUpdate (port 8080).
Right now I have my own update function that queries Tamino for the full XML then has 3 different types of updates. You have an insert update where the new XML fragment is inserted into the Tamino database at the specified location, a delete update which removes a node defined by XPATH from the full XML, and an update update which uses xpath to find the right location then replaces the XML node.
update(xml, xpath, type, databaseId)
where xml is the fragment of XML that will be inserted, deleted, or updated, xpath defines the location, type defines whether it is an insert update, delete update, or update update.
I’m using XALAN’s XPathAPI to determine if I’m in the correct place before I perform the operation. It all works (as of today ) I’m just worried about speed. Right now it seems ok, but as my XML gets larger I’m pretty sure that speed will become a huge factor.
I’m hoping the Tamino development group is keeping this in mind because it really seems like functionality the database should have.
Thanks for the advice on Apache and IIS I hadn’t thought about that.
There are node level update methods on the Tamino DOM API.They correspond to the four dom methods that do updates. They drive a protocol extension to Tamino which is interecepted by the IIS node update filter
insertBefore appendChild replaceChild removeChild
If your servlet supported these four operations and processed the same Tamino http protocol extensions your servlet would be exchangeable with the IIS node update extension and application builders could use the Java Jscript ActiveX and Perl interfaces with it.
This might make your implementation quite popular.