code: public StreamingOutput performQueryOnResource(final String resourceName, final long nodeId,
          final String query, final Map<QueryParameter, String> queryParams) {
  
          final StreamingOutput sOutput = new StreamingOutput() {
              @Override
              public void write(final OutputStream output) throws IOException, JaxRxException {
  
                  final String revision = queryParams.get(QueryParameter.REVISION);
                  final String wrap = queryParams.get(QueryParameter.WRAP);
                  final String doNodeId = queryParams.get(QueryParameter.OUTPUT);
                  final boolean wrapResult = (wrap == null) ? true : wrap.equalsIgnoreCase(YESSTRING);
                  final boolean nodeid = (doNodeId == null) ? false : doNodeId.equalsIgnoreCase(YESSTRING);
                  final Long rev = revision == null ? null : Long.valueOf(revision);
                  final RestXPathProcessor xpathProcessor = new RestXPathProcessor(mDatabase);
                  try {
                      xpathProcessor.getXpathResource(resourceName, nodeId, query, nodeid, rev, output,
                          wrapResult);
                  } catch (final TTException exce) {
                      throw new JaxRxException(exce);
                  }
              }
          };
  
          return sOutput;
      }
docs: This method is responsible to perform a XPath query expression on the XML
  resource which is addressed through a unique node id.
  
  @param resourceName
  The name of the database, the node id belongs to.
  @param nodeId
  The node id of the requested resource.
  @param query
  The XPath expression.
  @param queryParams
  The optional query parameters (output, wrap, revision).
  @return The result of the XPath query expression.