Hi,
I am a new user of tamino xml server and trying to add some information to a collection.
I have created a collection in a database, and I am trying to run XQueries on it using XQuery tool of XML Server. The problem is when I try to insert information, it returns an empty result and does nothing.
I have a person schema and my query is like this:
update insert
TwainCharles32
into input()/people
people is collection name, I have tried writing into input() and input/person but they don’t work too. I also tried deleting tags and repeated with the same input scenarios (with nothing, person and people). still don’t work and return empty result. I have changed the schema and added a people root as parent of person, where people may contain many persons, but again this XQuery didn’t work.
I will really be glad if somebody can help me on this, about adding some documents using XQuery.
By the way, I am using Tamino XML Server 4.1.1.1 on a Windows 2000 Server.
Here is my schema:
<?xml version = "1.0" encoding = "UTF-8"?>
<xs:schema xmlns:tsd = “http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition” xmlns:xs = “XML Schema”>
xs:annotation
xs:appinfo
<tsd:schemaInfo name = “person_schema”>
<tsd:collection name = “people”></tsd:collection>
<tsd:doctype name = “person”>
tsd:logical
tsd:contentclosed</tsd:content>
</tsd:logical>
</tsd:doctype>
</tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
xs:annotation
xs:documentation DTD for doctype person. </xs:documentation>
</xs:annotation>
<xs:element name = “person”>
xs:complexType
xs:sequence
<xs:element ref = “surname”></xs:element>
<xs:element ref = “firstname”></xs:element>
<xs:element ref = “age”></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name = “surname” type = “xs:string”></xs:element>
<xs:element name = “firstname” type = “xs:string”></xs:element>
<xs:element name = “age” type = “xs:decimal”></xs:element>
</xs:schema>
And this is my second schema, which again didn’t work(I also changed the XQuery according to the new field names, but still didn’t work):
<?xml version = "1.0" encoding = "UTF-8"?>
<xs:schema xmlns:tsd = “http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition” xmlns:xs = “XML Schema”>
xs:annotation
xs:appinfo
<tsd:schemaInfo name = “test1people”>
<tsd:collection name = “Test”></tsd:collection>
<tsd:doctype name = “people”>
tsd:logical
tsd:contentclosed</tsd:content>
</tsd:logical>
</tsd:doctype>
</tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
<xs:element name = “people”>
xs:complexType
<xs:sequence minOccurs = “0” maxOccurs = “unbounded”>
<xs:element ref = “person”></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name = “person”>
xs:complexType
xs:sequence
<xs:element ref = “firstName”></xs:element>
<xs:element ref = “lastName”></xs:element>
<xs:element ref = “age”></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name = “firstName” type = “xs:string”></xs:element>
<xs:element name = “lastName” type = “xs:string”></xs:element>
<xs:element name = “age” type = “xs:decimal”></xs:element>
</xs:schema>
Hello there.
I am not completely certain, but I think that we have a misunderstanding here.
The way that I understand the “update insert” to work is that is will insert nodes into existing documents that are specified by a query expression.
In your example, the query expression identifying the documents to be updated is “input()/person”.
If there are no documents matching this query, no documents will be updated.
To insert a whole document, you can put the document into a file and use the “Load” tab in the Interactive Interface, or load it using an API - or even load small documents using the HTTP command _process - something like this:
http://localhost/tamino/test/people?_process=<person><surname>Twain</surname><firstname>Charles</firstname><age>32</age></person>
I hope that helps,
Trevor.
Hi,
Thank you very much for your answer,
but I guess in my second schema where the people document item contains many person items, I should be able to do this insert. I loaded some person elements into document at first, and there were initial elements actully when I was trying to add new person elements.
Now I defined the schemas bib and reviews which are given in the XQuery examples in Tamino documentation, and I defined them with the original tsd files using tamino interactive interface. I loaded data from the given xml files using tamino interactive interface again and I queried the database using xQuery of Interactive Interface.
The XQueries where successful while bringing data from database, but again when I used the update insert statements given in the examples it again didn’t insert or delete the data to/from database. But at least Tamino Interactive Interface displayed the error, which is:
- <ino:message ino:returnvalue=“8552”>
<ino:messagetext ino:code=“INOXME8552”>Not a valid request</ino:messagetext>
ino:messagelineIt is not possible to open a cursor with XQuery Update Request.</ino:messageline>
</ino:message>
</ino:response>
So now I am working on to understand the reason that causes this error, and again any help will be appreciated.
Thanks again…
Now I installed the X-Plorer Update from the CD, and the query I run from the Tamino Interactive Interface still gives the same result.
But interestingly, now I run the same query with XQuery tool, and it works, at last I am able to add items into database
Hello,
I think that the reason for the INOXME8552 error is probably that you have some values in the “Pos. in Result” and “Result size” fields.
(Please see this posting.)
When there are values in these fields, the Tamino Interactive Interface passes them on to Tamino so that a cursor can be opened.
At the moment it is not possible to open a cursor for an Update request.
I hope that helps,
Trevor.
Hello,
Thanks a lot, now it works fine after I emptied those fields…