insertBefore

Folks:

Does anybody has some sample code on how to use “insertBefore” api in Tamino Client ?

Unclear about the “relative URL” part. I keep on getting “Element/Attribute not found” error.

–Naren

Hi,

insertBefore() takes three parameters, and heres a bit of explaination of each:

relURL - this is the relative URL to the document that is being updated. So this URL has to refer to an actual document, e.g. say if you have a document and you know its ino:id is 1 then the relative URL would be:

String relURL = “/collection/doctype/@1” ;

xpath - this is an XPath query that references within the aforementioned document (so not a X-Query statement) where to make the modification. e.g. If I had a document :

xxx

and I wanted to insert before a node then the xpath would be:
String xpath = “a/b” ;

node - this is of type org.w3c.dom.Node and you use DOM methods to construct it.

Hi Stuart:

Thanks for the info.

I tried “insertBefore” and I keep on getting following in tamino result -

Message Text: No message received
Message Line: null
Ino Code : INOXME8554

and the node never makes it to the document.

This is my document -




I have only one document in the collection.

I am using following for relUrl -

relURL - POCollection/polist/@1

POCollection - is the name of my collection
polist - is the doctype (figured this out by reading the schema file)
@1 - because I have only one doc in the collection (tried “0” as well didn’t work)

Is this the right way to use relUrl ?

Also, tried several combinations of xpath ?

Any suggestions…

–naren


quote:
Originally posted by Stuart Fyffe-Collins:
Hi,

insertBefore() takes three parameters, and heres a bit of explaination of each:

relURL - this is the relative URL to the document that is being updated. So this URL has to refer to an actual document, e.g. say if you have a document and you know its ino:id is 1 then the relative URL would be:

String relURL = “/collection/doctype/@1” ;

xpath - this is an XPath query that references within the aforementioned document (so not a X-Query statement) where to make the modification. e.g. If I had a document :

xxx

and I wanted to insert before a node then the xpath would be:
String xpath = “a/b” ;

node - this is of type org.w3c.dom.Node and you use DOM methods to construct it.


Do you you have the nodelevelupdate filter installed on your server?

If not it won’t work