Simple update

I am unsure, what I am missing. I am doing a simple update using the code below. The update never happens.

My tamino results look like -

Message Text: Element/attribute name not found
Message Line:
Ino Code : INOXRE8814


TaminoClient tamino = new TaminoClient(“http://localhost/tamino/Perf/PO1M”);
tamino.startSession();
String tq = “/polist/po[5]/lineitems/lineitem[1]/item”;
TaminoResult tr = tamino.query(tq);
Document doc = tr.getDocument();
Element item= (Element)tr.getElement).getFirstChild();
Element price = (Element)item.getElementsByTagName(“price”).item(0);
price.getChildNodes().item(0).setNodeValue(“$9999”);
TaminoResult tr2 = tamino.update(item);
System.out.println(“item=” + item);
System.out.println(“tr2=” + tr2);
tamino.commit(true);
tamino.endSession();
:confused:

Can we have some idea what the structure of the schema is?

Does the query find a document?

Does System.out.println show anything?

quote:
Can we have some idea what the structure of the schema is?

The document is list of Purchase Orders(PO), with each PO having multiple lineitems. So the structure looks like -









quote:

Does the query find a document?
Does System.out.println show anything?

Yes, the query finds the relevant node. I can also see that update happens in memory on that node. However, when I use tamino.update(element), nothing happens.

I also tried different variation of update API with no luck.

Appreciate if you have any feedback.

--naren

This something that is unclear to me.

I have document that contains list of Purchase Orders (PO), the structure is as shown above. Now I have create a collection and I have added only one document (polist.xml). This XML document contains 300 PO’s.

When I do a query using TII (Tamino Interactive Interface), the result always shows all the elements as having “ino:id=1”.

For instance, if the query is - /polist/po - all po’s have ino:id of 1. If the query is /polist/po/customer - then all customers have ino:id=1.

I thought each node has unique “ino:id”. Anybody willing to throw some light ??

–naren

All now becomes clear…

Bill Leeney points out the following about your Java code. The query

String tq = “/polist/po[5]/lineitems/lineitem[1]/item”;

returns a small subset of the whole document, not the whole document itself. As Tamino update takes place on a ‘whole document’ level i.e. you can’t just specify one node/element in an update, there is no surprise that when you try to use the result of this query in an update it doesn’t work. You need to get the whole document, change the elements you wish to change and write the whole document back again with update.

As for your second problen, inoids, any defined schema in Tamino will store multiple documents of that schema. Each of these documents has a unique inoid, not the elements/nodes within the document.
You state " I have added only one document" so therefore it is no surprise that query results only show inoid 1.

If your schema was





You could present each po to tamino separately. Each stored po would then have it’s own unique ino:id.

Thank you guys.

So, I HAVE to get the “whole document” to small little update somewhere in my subtree. I missed this in documentation.

–naren