DocumentSet docs = null;
	public Hashtable queryP(User user, String xpath, String docName,			String s_id, Hashtable parameters) throws Exception {		long startTime = System.currentTimeMillis();		String sortBy = (String) parameters.get(RpcAPI.SORT_EXPR);		Hashtable ret = new Hashtable();		Vector result = new Vector();		NodeSet nodes = null;		DocumentSet docs = null;		QueryResult queryResult;		Sequence resultSeq = null;		DBBroker broker = null;		try {			broker = brokerPool.get(user);			if (docName != null && s_id != null) {				long id = Long.parseLong(s_id);				DocumentImpl doc;				if (!documentCache.containsKey(docName)) {					doc = (DocumentImpl) broker.getDocument(docName);					documentCache.put(docName, doc);				} else					doc = (DocumentImpl) documentCache.get(docName);				NodeProxy node = new NodeProxy(doc, id);				nodes = new ArraySet(1);				nodes.add(node);				docs = new DocumentSet();				docs.add(node.getDocument());			}			queryResult = doQuery(user, broker, xpath, docs, nodes, parameters);			if (queryResult == null)				return ret;			resultSeq = queryResult.result;			LOG.debug("found " + resultSeq.getLength());						if (sortBy != null) {				SortedNodeSet sorted = new SortedNodeSet(brokerPool, user,						sortBy);				sorted.addAll(resultSeq);				resultSeq = sorted;			}			NodeProxy p;			Vector entry;			if (resultSeq != null) {				SequenceIterator i = resultSeq.iterate();				if (i != null) {					Item next;					while (i.hasNext()) {						next = i.nextItem();						if (Type.subTypeOf(next.getType(), Type.NODE)) {							entry = new Vector();							if (((NodeValue) next).getImplementationType() == NodeValue.PERSISTENT_NODE) {								p = (NodeProxy) next;								entry.addElement(p.getDocument().getCollection().getName() + '/' + p.getDocument().getFileName());								entry.addElement(Long.toString(p.getGID()));							} else {								entry.addElement("temp_xquery/"										+ next.hashCode());								entry.addElement(String										.valueOf(((NodeImpl) next)												.getNodeNumber()));							}							result.addElement(entry);						} else							result.addElement(next.getStringValue());					}				} else {					LOG.debug("sequence iterator is null. Should not");				}			} else				LOG.debug("result sequence is null. Skipping it...");		} finally {			brokerPool.release(broker);		}		queryResult.result = resultSeq;		queryResult.queryTime = (System.currentTimeMillis() - startTime);		connectionPool.resultSets.put(queryResult.hashCode(), queryResult);		ret.put("id", new Integer(queryResult.hashCode()));		ret.put("results", result);		return ret;	}