xql:result

How can I check if node “xql:result” exists when tamino returned values from my query? I know that “xql:result” only exists when query returns at least one element from mydb tamino.

thanks in advance!

best regards,
Dariusz Baumann

You can use :
public boolen hasQueryContent()

true if the response of Tamino contained any result information, false otherwise.

@nto

yes, I found in documentation:

-------------------------------------
hasQueryContent

public boolean hasQueryContent()

Indicates if the response of Tamino contained any result information. Result information is only produced for queries, not for any other operations. Returns false if the query did not produce any results.
Returns:
true if the response of Tamino contained any result information, false otherwise.
-------------------------------------

Unfortunately, I don’t know how I should use this method “hasQueryContent()” of object “TResponse”.

I need sample code.

thanks in advance!

best regards,
Dariusz Baumann

U can try with the following snipped of code:

After u have done a connection and u have obtained an accessor u do:

TResponse response = accessor.query(query);

if(response.hasQueryContent()){

//u got it

}
else
//u don’t got it

First of all, I need full sample code about “hasQueryContent()” method because I do not know what it is “accessor” object, and how I should initialize it.

thanks in advance!

best regards,
Dariusz Baumann

Hi Dariusz,

The TResponse object comes from the TaminoAPI4J and not from the TaminoClient API. So the following snipet of code could be used to achieve what the hasQueryContent() method does:-

TaminoResult tr = tc.query (DOCTYPE) ;
boolean hasQueryContent = (tr.getDocument().getElementsByTagName(“xql:result”).getLength() > 0)? true : false ;

Hope this helps.


Stuart Fyffe-Collins
Software AG (UK) Ltd.