problem with Xquery Update Insert

Hi,
I would be grateful if someone could help me,.
I am using Tamino version 4.4.1.
I want to insert a new node “…”
into an existing element of an existing document on Tamino database.
I have the document in Attachment.
I used the Tamino X-Query whit this query:

update insert



LOMv1.0


prerequisito




http://www.giuntilabs.com/MIEET.xml


200

University




into input()/manifest[@identifier=‘Equacao_de_estado_e_de_saida’]/resources/
resource/metadata/lom

when I execut the query I have no error, but the document(doc.xml) on the Tamino don
doc.xml (10.2 KB)

Hi,

I had to correct your input document, as it contained an undeclared namespace prefix “xp:”
Then, I corrected the string searched for in the [@identifier=…] filter, and then the query worked…

Regards

Harald

Thank you,

I put the namespace … xmlns=“http://www.i msglobal.org/xsd/imscp_v1p1/” xmlns:xp=“http://www.giuntilabs.com/exact/xp_v1d0
on the doc.xml and I corrected string searched
for into input()/manifest[@identifier=‘Comportamento_em_regime_estacionrio’]/resources/
resource/metadata/lom

but it didn

Hi,

with the namespace you added, you have to addthe following declaration as the first line of your query:


declare default element namespace "http://www.i msglobal.org/xsd/imscp_v1p1/" 

my query is:

declare default element namespace “http://www.imsglobal.org/xsd/imscp_v1p1
update insert

LOMv1.0 prerequisito http://www.giuntilabs.com/MIEET.xml 200 University into input()/manifest[@identifier='Comportamento_em_regime_estacionrio']/resources/ resource/metadata/lom

and my document whit change is on Attachment

I did every thing you sugest but it didn’t work. I didin’t have erro but the document on the database don’t update.
doc.xml (10.4 KB)

This is because you changed your document even more. The issue with your query is that the namespaces you specify in teh query do not fully match the namespaces in your document. If you leave your document unchanged, the following query will work. However, I do not know whether it CREATES the elements in teh correct namesypace becasue I do not know which namespace you intend the elements to be in, so your might have to adapt teh query accordingly:


declare default element namespace "http://www.imsglobal.org/xsd/imscp_v1p1"
declare namespace p2="http://www.imsglobal.org/xsd/imsmd_v1p2"
update insert
<classification>
<purpose>
<source>
<langstring>LOMv1.0</langstring>
</source>
<value>
<langstring>prerequisito</langstring>
</value>
</purpose>
<taxonpath>
<source>
<langstring>http://www.giuntilabs.com/MIEET.xml</langstring>
</source>
<taxon>
<id>200</id>
<entry>
<langstring>University</langstring>
</entry>
</taxon>
</taxonpath>
</classification>
into input()/manifest[@identifier='Comportamento_em_regime_estacionrio']/resources/
resource/metadata/p2:lom 

Regards

Harald

Thank you

I have my document with no change, but

it still no working. when I execut the query

I have error : INOXDE7730(cvc-model-group.1):invalid end of sequence

best regards

Lfernandes

So this indicates that you have a schema defined for your doctype. WIthout knowing this schema I can only guess what your problem is now: the elements you insert do not match the schema definition, e.g. are in the wrong namespace

Regards

Harald

Hi Harald,
Thank you very much for your help.

Iam using these schema in attachement.

If you can help me again I would be grateful.
This work is very important and I must do it.

best regards

Lfernandes
Schema.rar (7.73 KB)

Hi,

please try


declare default element namespace "http://www.imsglobal.org/xsd/imsmd_v1p2"
declare namespace p2="http://www.imsglobal.org/xsd/imsmd_v1p2"
declare namespace p1="http://www.imsglobal.org/xsd/imscp_v1p1"
update insert
<classification>
<purpose>
<source>
<langstring>LOMv1.0</langstring>
</source>
<value>
<langstring>prerequisito</langstring>
</value>
</purpose>
<taxonpath>
<source>
<langstring>http://www.giuntilabs.com/MIEET.xml</langstring>
</source>
<taxon>
<id>200</id>
<entry>
<langstring>University</langstring>
</entry>
</taxon>
</taxonpath>
</classification>
into input()/p1:manifest[@identifier='Comportamento_em_regime_estacionrio']/p1:resources/
p1:resource/p1:metadata/p2:lom 

Regards

Harald

Thank you very much for your help.

It worked perfectly.

I am very grateful.

My best wishes,

have an excellent day!

Best regards,

Lfernandes