X-Tension as Trigger

Hi to everybody,

I am trying to use the X-Tension function as a trigger.

The purpose of my trigger is to extract a kind of a summary and to store it in another doctype for rapid access.

Assigning a “X-Tension Map In Function” (Tamino 3.1 Schema Editor: Storage Type: Map XTension; Property: onProcess) to the document’s root element the document is not stored in Tamino.

Therefore I placed my map in function in a particular collection, that is dedicated to the trigger. My function takes the whole document and stores it in Tamino. After that the function searches the summary and stores it another doctype.
public void mapin (int object_id, int element_id, String document) {
// store document into Tamino
String collName = new String(“myColl”);
String reqContent = new String(document);
StringBuffer xmlBuf = new StringBuffer();
int ret = SxsXMLProcess(collName, reqContent, xmlBuf);
// …
// here starts the actual Trigger functionality

Obviously, this proceeding is not very performant.

1) Is it possible to instruct Tamino to store always the whole document, even if there is a mapin function on the root element?
2) If not, how can I avoid that Tamino stores an empty document with only the root element ( ) ? I prefered if Tamino stored nothing at all in that case.
3) Is there another way to implement a trigger?

Question 3 aims at an article Johannes wrote in the topic “XTension Examples”:
"We have tried this [to use the map in function] and came to the conculsion that the SXS cannot be used for triggers, because it then does not store/process the node which you trap on. The SXS events seems to be designed for when you need to get and store data externally. What we then did instead is to create SXS functions(query), which can act on the document after it is stored."

3a) How can you implement a trigger with query functions?
3b) Do you have code examples?

Thanks for ideas.

Hi, S

Hello S