Hi,
I am trying to insert a new node (defined as optional, xs:decimal in the schema TSD4 - Tamino 4.1.4.1).
In the Tamino Interactive Interface I use the following xquery:
update for $a in input()/test
let $b := input()/test/data/pr1
do insert { $b }
following $a/data
I want to insert the node after the data-node. The node should have the value stored in (both defined as xs:decimal).
From the TII I get the following response:
- <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>
What is wrong with my query?
Thanks for the help.
I unmarked the “Position in result”-checkbox and Tamino responds with an error:
- <ino:message ino:returnvalue=“9291”>
Hi,
the attribute ino:id can not be accessed directly, use the internal
function getInoId() instead as follows:
declare namespace tf=“http://namespaces.softwareag.com/tamino/TaminoFunction”
update for $a in input()/test[tf:getInoId(.) < 10] …
Regards,
Juliane.
Hi,
Sounds good. I tried it, but the transaction still gets aborted, because it takes too long.
So I put the tf:getInoId-Function additionally in the “let $b…” clause. Then we get to the real problem: Tamino answeres as follows:
<?xml version="1.0" encoding="windows-1252" ?>
- <ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response2” xmlns:xql=“XQL FAQ (XML Query Language - Frequently Asked Questions)”>
- <xq:query xmlns:xq=“http://namespaces.softwareag.com/tamino/XQuery/result”>
- <![CDATA[
declare namespace tf="http://namespaces.softwareag.com/tamino/TaminoFunction"
update for $a in input()/ERKLAERUNG[tf:getInoId(.) < 10]
let $b := input()/ERKLAERUNG/VERTRAGSDATEN/PRAEMIE_ANFORD[tf:getInoId(.) < 10]
do insert { $b }
following $a/VERTRAGSDATEN
]]>
</xq:query>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQuery Update Request processing</ino:messageline>
</ino:message>
- <xq:result xmlns:xq=“http://namespaces.softwareag.com/tamino/XQuery/result”>
<ino:object ino:collection=“Fon” ino:doctype=“ERKLAERUNG” ino:id=“1” />
</xq:result>
- <ino:message ino:returnvalue=“7718”>
<ino:messagetext ino:code=“INOXDE7718”>(cvc-type.3.1.2): invalid element content</ino:messagetext>
ino:messagelineLine 0, Column 0: [element “PRAEMIE_ANFORD” in element “PRAEMIE_GENEHMIGT”]</ino:messageline>
</ino:message>
</ino:response>
Thanks.
Possibly I have an explanation for the error-message: Could Tamino want to insert the whole node with $b? (including brackets <…> xx </…>)
What I need then is a sort of “value-of($b)”-function. Does anyone know a function like that (or maybe a workaround)?
Thanks.
I found the following (sort of a workaround):
…
do insert { xs:decimal(string($b)) }
the node is defined as decimal in the schema, nevertheless I get a RUNTIME TYPE EXCEPTION.
Could someone please explain that to me.
Thanks.
Hi,
hard to tell without knowing your data, but it seems that $b is bound to more than one value. In this case, you cannot just cast to integer.
Please provide some sample data, and a sample of teh update you want to achieve. I will then try to write down a sample update statement.
Regards
Harald
Hi,
The data I have got basically looks as follows:
------
<?xml version="1.0" encoding="ISO-8859-1"?>
123.45
123.45
------
is the node I want to insert
My xquery:
------
update for $a in input()/test
let $b := input()/test/data/pr1
do insert { xs:decimal(string($b)) }
following $a/data
------
… type in schema - xs:decimal
Thanks for your help.
Hi,
Can you try a XQuery wihch looks like this:
update for $a in input()/test
let $b := input()/test/data/pr1
do insert { $b/text() }
following $a/data
I did the test on only one XML document so I don’t know if it will solve your problem.
Regards
Ludovic
Hi,
unfortunately this doesn’t work. I get the following message from Tamino:
- <ino:message ino:returnvalue=“7763”>
<ino:messagetext ino:code=“INOXDE7763”>(cvc-datatype-valid) An invalid value has been found during validation</ino:messagetext>
ino:messagelineLine 0, Column 0: datatype validation for element “PRAEMIE_GENEHMIGT” of type xs:decimal failed:</ino:messageline>
</ino:message>
Thanks anyway.
Hello Gurod,
Can you send me the TSD and some XML documents you use?
Regards,
Ludovic