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.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
Expand all | Collapse all

insert a node into an existing document

  • 1.  insert a node into an existing document

    Posted 03/26/04 08:33 AM

    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.


    #webMethods
    #Tamino
    #API-Management


  • 2.  RE: insert a node into an existing document

    Posted 03/26/04 09:40 AM

    I unmarked the “Position in result”-checkbox and Tamino responds with an error:
    - <ino:message ino:returnvalue=“9291”>


    #API-Management
    #Tamino
    #webMethods


  • 3.  RE: insert a node into an existing document

    Posted 03/26/04 10:56 AM

    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.


    #API-Management
    #Tamino
    #webMethods


  • 4.  RE: insert a node into an existing document

    Posted 03/26/04 11:36 AM

    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.


    #webMethods
    #API-Management
    #Tamino


  • 5.  RE: insert a node into an existing document

    Posted 03/29/04 07:12 AM

    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.


    #Tamino
    #webMethods
    #API-Management


  • 6.  RE: insert a node into an existing document

    Posted 03/29/04 12:17 PM

    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.


    #webMethods
    #Tamino
    #API-Management


  • 7.  RE: insert a node into an existing document

    Posted 03/30/04 11:11 AM

    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


    #Tamino
    #webMethods
    #API-Management


  • 8.  RE: insert a node into an existing document

    Posted 03/31/04 05:57 AM

    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.


    #webMethods
    #API-Management
    #Tamino


  • 9.  RE: insert a node into an existing document

    Posted 04/06/04 06:52 PM

    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


    #API-Management
    #Tamino
    #webMethods


  • 10.  RE: insert a node into an existing document

    Posted 04/07/04 11:59 AM

    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.


    #API-Management
    #webMethods
    #Tamino


  • 11.  RE: insert a node into an existing document

    Posted 04/08/04 10:56 AM

    Hello Gurod,

    Can you send me the TSD and some XML documents you use?

    Regards,

    Ludovic


    #webMethods
    #API-Management
    #Tamino