count function returned value

Hi all,
how can i get the returned value of count function in my application?
I got the nullpointerException at the line

TResponse tresp=accessor.xquery ("count(for $q in input()/organisation return $q)") ;
String i=tresp.getQueryContentAsString();

the variable i has a value"xq:value/"
I have tested the xquery expression in x-plorer and got the right returned value.
I have no idea, why it doesn’t work in my application.

Thanks in advance,


I can’t account for why you’re not getting a result, unless you have a typo somewhere that doesn’t show up in your example. But you could simplify your query:


Wrapping the input in a FLWOR expression doesn’t accomplish anything here.

Thank you for your suggestion.
Here is my code, your simple query returned the same value"xq:value/"

This problem is solved with the suggestion from member mj. Thank you very much.