How to add new documents via XQuery

Hello!

I am still a beginner using Tamino, I think it is an old, and often asked question but the forum search didn’t show me a result.

I want to insert a new document into a collection using a xquery.
Is that possible with Tamino 4.4.1?
If(true){please give me an example :-)}

I tried:

update insert 
<book year="2001">
<title>XML Schema Part 0: Primer</title>
<editor>
<last>Fallside</last>
<first>David C.</first>
<affiliation>IBM</affiliation>
</editor>
<publisher>World Wide Web Consortium</publisher>
<price>0.00</price>
</book>
into input()/Module

in the Tamino-X-Query-Tool, the query returns an empty result set, no error. But there is noch change in the database visible…

I think I am walking down an meander… I want to get back on the good path.

Thanks,

Jens

Jens,

the simple and sad answer is: you can’t, Tamino’s XQuery currently does not support that

Regards

Harald

That was the Xquery answer from “Guru” Harald…

The workaround would be to program a “Server extension function” in for instance Java, that could do the job.

  • agree Harald ?

regards Finn

Finn, I agree I was too short. Yes, there are various options to do an insert, ranging from a server extension over using one of the Tamino APIs, the HTTP interface, the Tamino Interactive Interface, the WebDAV interface etc.

Regards

Harald

Jans,

I use a rather brute force method of inserting new instances into a collection - I do an http POST of the content. The key is using this header:
Content-Disposition: form-data; name=“_Process”.
I hope I’m not forgetting something else important but I checked my code and I don’t see anything else.

Beware: I learned this technique 6 years ago but I still use it today.

Allen

Hello!

Thank you very much for the quick and qualified answers. I see, i have to use the Tamino API to insert the documents.

You saved me a lot of “try and error” time :slight_smile:

Jens