IBM Integration

IBM 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
  • 1.  xquery in java api, multiple insert

    Posted 06/03/05 04:36 PM

    hi,
    I’m inserting multiple elements into a certain node.
    I’m using xquery and right now, I’m using this code:

    for (int i=0; i< elementIds.length; ++i) {
    xpathQuery2 = "update insert <element_id>"+elementIds[i]+"</element_id> into "+xpathQuery1;
    xQuery = TXQuery.newInstance( xpathQuery2);
    resp2 = xmlAccessor.xquery( xQuery); // techn. update
    }

    I was wondering if there is a better solution to this, possibly a better xquery statement - it doesn’t seem very efficient to me to call the xquery method over and over!
    I couldn’t find anything on this in the docs, so comments welcome!
    thanks!


    #webMethods
    #webMethods-Tamino-XML-Server-APIs
    #API-Management


  • 2.  RE: xquery in java api, multiple insert

    Posted 06/06/05 09:01 AM

    Hi,
    you can do it all in one XQuery statement. The trick is to insert a sequence of nodes rather than a single node:

    
    xpathQuery2 = "update insert ("
    for (int i=0; i< elementIds.length; ++i) { 
    xpathQuery2 =xpathQuery2 + "<element_id>"+elementIds[i]+"</element_id>"
    }
    xpathQuery2 = xpathQuery2 + ") into "+xpathQuery1; 
    xQuery = TXQuery.newInstance( xpathQuery2); 
    resp2 = xmlAccessor.xquery( xQuery); // techn. update 

    #webMethods-Tamino-XML-Server-APIs
    #webMethods
    #API-Management


  • 3.  RE: xquery in java api, multiple insert

    Posted 06/06/05 04:36 PM

    superb! that’s exactly what I need!

    seperate the sequence’s elements with “,” and it works!

    thanks a lot!


    #webMethods
    #API-Management
    #webMethods-Tamino-XML-Server-APIs