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

Retrieving a list using the for loop instead of a while loop

  • 1.  Retrieving a list using the for loop instead of a while loop

    Posted 12/08/03 09:37 AM

    How will you retrieve a list of XML documents from the Tamino database without using the TXMLObjectIterator of which you must use the while statement, but using something that you can apply a for loop.
    Eg.

    response = processQuery("for $e in input()/Employee return $e");
    if (!response.hasFirstXMLObject()) 
    throw new Exception("Nothing found");
    xmlObject = response.getFirstXMLObject();
    TXMLObjectIterator empIt = response.getXMLObjectIterator();
    while (empIt.hasNext()) {  


    Please advise.
    Best Regards


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


  • 2.  RE: Retrieving a list using the for loop instead of a while loop

    Posted 12/08/03 09:59 AM

    Hello,

    The best thing to use is the Iterator especially if a pagesize is being used. What you could do is construct a Vector, use the iterator to add items to the Vector. Then you can convert the Vector into an array and then simply use for loops to work through the array.

    Hope this helps.

    Stuart Fyffe-Collins
    Software AG (UK) Ltd.


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