I need DemoModify sample

Hello!

I just want to modify only one field in my tamino mydb. I have been looking for sample code in documentation in topic “HTTP Client API for Java”, unfortunately I have just found:
1) DemoPing
2) DemoInsert
3) DemoQuery
4) DemoDelete

Can you help me in this case?

Thanks in advance, a lot.

Best regards,
Dariusz Baumann

hi,

what you will probably need to do is:

take the DemoQuery to retrieve the document you want to update,

modify the resulting DOM object

finally, do an update operation which returns the whole document to the database. you will have to check documentation to get the exact usage.

at this time, an individual update on node level is not supported.

best regards,
andreas f.

take the DemoQuery to retrieve the document you want to update,
---------------------
OK. :slight_smile:

modify the resulting DOM object
---------------------
OK. :slight_smile:

finally, do an update operation which returns the whole document to the database. you will have to check documentation to get the exact usage.
---------------------
I couldn’t find it in documentation. Please help me. :frowning:

at this time, an individual update on node level is not supported.
---------------------
Why? Is it extremely difficult to implement?

By the way:
“Is it difficult to show SAMPLE CODE TO MODIFY DATA STORED IN TAMINO ?”
:mad: :mad: :mad:

Best regards,
Dariusz Baumann

Hi Dariusz,

Check out the javadoc documentation for the TaminoClient API. The TaminoClient object has a process() method which inserts or updates a DOM element (which will the root document node) into Tamino. If the document contains an ino:id attribute on the root element then Tamino will update the existing document with that ino:id. Otherwise Tamino will insert a new document into the collection.

TaminoClient does support partial tree update but only if you use the NodeLevelUpdate feature which requires IIS as your webserver. The methods which utilitize the NodeLevelUpdate filter are insertBefore(), appendChild(), removeChild() and replaceChild().

Hello Stuart Fyffe-Collins!

I need sample code to modify data stored in TAMINO.

ONE EXAMPLE shows more that hundreds of pages…

Thanks in advance, for example source code!

Best regards,
Dariusz Baumann

Hi Dariusz,

here’s a very simple example. Hope this helps.

import com.softwareag.tamino.API.dom.;
import org.w3c.dom.
;

public class UpdateExample {
public static void main (String args) {
try{
TaminoClient tc = new TaminoClient(“http://localhost/tamino/mydb”);
TaminoResult tr ;

tr = tc.query(“example”, “ino:etc”);

Element e = tr.getNextElement();
Document doc = e.getOwnerDocument();

Element eNew = doc.createElement (“somenode”);
Text tNew = doc.createTextNode(“XXXX”);
eNew.appendChild(tNew);
e.appendChild(eNew);

tr = tc.process(e) ;//Update

} catch (Throwable ex) {
ex.printStackTrace();
}
}
}

:cool: :cool: :cool: :cool: :cool:

It doesn’t work.
It doesn’t update tamino db.

:mad: :mad: :mad: :mad: :mad:

Regards,
Dariusz Baumann

Sorry Dariusz, but I re-compiled and reran this program and it updates my one and only document that I stored in the ino:etc collection. I am using j2se 1.3.1_02 with Tamino v3121, and using the very latest TaminoAPI4J obtainable from the downloads area. Before I ran the program I checked the document:


A


and after I run the program:


A
XXXX


:smiley:

Hello Stuart Fyffe-Collins!

I want to MODIFY tag , NOT insert new node . So, I want to get after executing your sample code the following result:


XXXX


Please help me in this case!

Any help will be very appreciated!

Thanks a lot for support!

Best regards,
Dariusz Baumann

The “modify” code you need to implement is all done using pure DOM Level 1 methods. So for example if I want to alter in the above example, all I need to do is change the code between getting the document and processing it, i.e.

NodeList nl = e.getElementsByTagName(“somenode”) ;
Element eExist = (Element)nl.item(0);
Text eExistText = (Text)eExist.getFirstChild() ;
eExistText.setNodeValue(“B”);

Simple! :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: