IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

problem with Xquery Update Insert

  • 1.  problem with Xquery Update Insert

    Posted Tue September 09, 2008 12:03 PM

    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)


    #Tamino
    #webMethods
    #API-Management


  • 2.  RE: problem with Xquery Update Insert

    Posted Tue September 09, 2008 12:57 PM

    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


    #API-Management
    #Tamino
    #webMethods


  • 3.  RE: problem with Xquery Update Insert

    Posted Tue September 09, 2008 02:36 PM

    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


    #Tamino
    #API-Management
    #webMethods


  • 4.  RE: problem with Xquery Update Insert

    Posted Tue September 09, 2008 02:57 PM

    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/" 

    #webMethods
    #API-Management
    #Tamino


  • 5.  RE: problem with Xquery Update Insert

    Posted Tue September 09, 2008 03:21 PM

    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)


    #Tamino
    #webMethods
    #API-Management


  • 6.  RE: problem with Xquery Update Insert

    Posted Tue September 09, 2008 04:51 PM

    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


    #webMethods
    #Tamino
    #API-Management


  • 7.  RE: problem with Xquery Update Insert

    Posted Tue September 09, 2008 06:20 PM

    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


    #API-Management
    #Tamino
    #webMethods


  • 8.  RE: problem with Xquery Update Insert

    Posted Wed September 10, 2008 09:49 AM

    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


    #API-Management
    #Tamino
    #webMethods


  • 9.  RE: problem with Xquery Update Insert

    Posted Wed September 10, 2008 12:09 PM

    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)


    #Tamino
    #API-Management
    #webMethods


  • 10.  RE: problem with Xquery Update Insert

    Posted Wed September 10, 2008 02:40 PM

    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


    #Tamino
    #webMethods
    #API-Management


  • 11.  RE: problem with Xquery Update Insert

    Posted Wed September 10, 2008 04:01 PM

    Thank you very much for your help.

    It worked perfectly.

    I am very grateful.

    My best wishes,

    have an excellent day!

    Best regards,

    Lfernandes


    #API-Management
    #webMethods
    #Tamino