How to append child element to tamino document

Hi,

I want to append child node to tamino document without downloading whole document first. IIS filter is installed.

I have tried to do it with following javascript code, but nothing happend:

+++++++++++++++++++++++++++++
QueryObj = new TaminoClient(dbname, pageSize);
QueryObj.startSession();

//Node to be inserted
tempNode = XMLRDBDocNode.firstChild;
test = QueryObj.appendChild("/RootNode/@1","/RootNode/ChildNode/",tempNode);

test1 = QueryObj.commit();
QueryObj.endSession();

document.write("test: “+test+” test1: "+test1);

++++++++++++++++++++++++++++

and the print result was :"test: [object Object] test1: [object Object]"

Can anyone help me please?

Regards
-Coolman

On the this page Tamino Developer there is a document referenced “From NodeLevelUpdate Methods to XQuery Usage” that should provide suitable examples of NodeLevelUpdate usage.

However please note that if you are using Tamino 4 then you would be better off using XQuery update functionality rather than NodeLevelUpdate. The performance of XQuery should be signficantly faster than NodeLevelUpdate. NodeLevelUpdate is “old hat” and was implemented long before Tamino supported XQuery.

My appendChild doesn’t work.

I have Tamino version 4.1.4, how I can use XQuery update functionality with javascript.

-CoolMan

Do you have a method “xquery” in TaminoLib.js?

If you do then you can use XQuery update like the examples provided in the NodeLevelUpdate Migration guide.

My TaminoLib.js attached…

-CoolMan
TaminoLib.js (44 KB)

Unfortunately it looks like you don’t have the xquery function in this version.

Why my nodelevelupdate don’t work.

I tried Stuart Fyffe-Collins’s NodelevelUpdate_examples from site: http://tamino.forums.softwareag.com/viewtopic.php?p=6740.

Everything else is working but, xml-document is not updated.

I need still help…

-CoolMan

AppendChild function below:

function AppendChild()
{
var DATABASEURL = “http://XXX/tamino/x_database” ;
var COLLECTION = “nodelevelupdate” ;

var tam = new TaminoClient (DATABASEURL) ;
tam.setEncoding(“utf-8”);

// we will update the document with ino:id = 2
// by appending a new node d to the end of the document.
var doc = new ActiveXObject(“MSXML2.DOMDocument”) ;
var elem = doc.createElement (“d”) ;
var text = doc.createTextNode (“node d value is d1”) ;
elem.appendChild (text) ;

var relURL = “/” + COLLECTION + “/sample/@2” ;
var xpath = “sample” ;
tam.appendChild (relURL, xpath, elem) ;
}


-CoolMan

I must admit that seeing errors from NodeLevelUpdate is not very easy!

However, note that most node level update operations require that the node you operate on is unique. So if in your document /RootNode/ChildNode does not define a unique node then the operation will not work.