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.


#TechXchangePresenter
 View Only
Expand all | Collapse all

retrieving a (random) XML document

  • 1.  retrieving a (random) XML document

    Posted Wed September 01, 2004 03:11 PM

    Hi!

    So, here we go:
    I would like to retrieve an arbitrary document from a known collection and a known doctype.
    When I send the following XQuery to the database:

    String querystring = “let $a:=input()/doctypename return count($a)”;

    I received 250242. So I guess that means there are 250242 documents of that specific doctype.
    Afterwards, I changed the XQuery expression to:

    String querystring = “let $a:=input()/doctypename return $a”;

    I didn’t get any result, it just didn’t terminate.
    So I figured it is because of the size, so I didn’t use the usual
    accessor.xquery(query);
    method but
    accessor.xquery(query, 1);

    Anyways, it was the same - no termination.

    I thought that second method would just give me one result document?

    How else could I do that?
    Thanks for helping out!


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


  • 2.  RE: retrieving a (random) XML document

    Posted Mon September 06, 2004 10:41 AM

    Hi there,

    Please try out with the below xquery, perhaps that is what you require -

    declare namespace tf = “http://namespaces.softwareag.com/tamino/TaminoFunction
    declare namespace ino=“http://namespaces.softwareag.com/tamino/response2
    for $q in input()/ino:nonXML
    where tf:getInoId($q) = 1
    return $q

    Rahul Roy

    Tamino API for Java
    Software AG (INDIA)


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


  • 3.  RE: retrieving a (random) XML document

    Posted Tue September 14, 2004 12:49 AM

    Hello dax42,

    the expression “let $a:=input()/doctypename return $a” will assign all the documents of type “doctypename” to the variable $a, so returning “just one result” with a cursor will not help - the one result document contains all the “doctypename” documents!

    I would follow a similar course to the one outlined by Rahul Roy: use a “for” rather than a “let”.

    I hope that helps,
    Trevor.


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