inserting data @ different nodes.

hi there,

i’m working on a tamino 3.1.1.4 database & i would like to store documents suitable to a scheme like this:
<?xml version="1.0"?>


// min occurs 0, max occurs unbounded


// min occurs 0, max occurs unbounded






(of course, my files are much more complex, but this explains the most)

next step:
with a jscript “process” function i have inserted a document with some parent “notes”-text but all other nodes empty. this document in the database is now registered as


text


next step - i would like to insert a “child” and its 2 toys:
<?xml version="1.0"?>



andy


buzz lightyear


woody





i am using the same form for updating my database. everything works fine, a new document is inserted as




my function:

function XmlToDB ()
{
var dbname=“http://localhost/tamino/mydb/coll”;
var dbuser=“user”;
var pageSize=12;
var ProcessObj;
var QueryResult;
var ProcessResult;
var xqlResult;
var xmlDoc = new ActiveXObject(“Msxml2.DOMDocument”);

xmlDoc.async = false;
xmlDoc.load(“tmp/update.xml”);
ProcessObj = new TaminoClient(dbname,pageSize,dbuser);
ProcessResult = ProcessObj.process(xmlDoc);

if (ProcessResult.errorNo == “0”)
// some error routines
};
};

question: i would like to insert child-documents into the ‘ino:id=“1”’ parent document. how do i have to “enhance” the function for this? is the child_updateDocument inthe right format?

thanks for help

regards
ak.

The way Tamino differentiates an insert operation and an update operation is if the root node (in your case ) contains the ino:id attribute. If the node contains the ino:id attribute thus:



then Tamino will update that document. If the ino:id does not exist an error is returned because this means you are attempting to update a non-existant document.

I would recommend using the Tamino JScript API. With that there is a method for querying for the original document (which will contain the ino:id), use DOM methods for updating the document, and then use the process method to update it back.