XQueryLexer lexer = new XQueryLexer(new StringReader(selectStmt));
XQueryLexer lexer = new XQueryLexer(context, new StringReader(selectStmt));
	protected NodeList select(DocumentSet docs)		throws PermissionDeniedException, EXistException, XPathException {		try {			XQueryContext context = new XQueryContext(broker);			context.setExclusiveMode(true);			context.setStaticallyKnownDocuments(docs);			Map.Entry entry;			for (Iterator i = namespaces.entrySet().iterator(); i.hasNext();) {				entry = (Map.Entry) i.next();				context.declareNamespace(					(String) entry.getKey(),					(String) entry.getValue());			}			XQueryLexer lexer = new XQueryLexer(new StringReader(selectStmt));			XQueryParser parser = new XQueryParser(lexer);			XQueryTreeParser treeParser = new XQueryTreeParser(context);			parser.xpath();			if (parser.foundErrors()) {				throw new RuntimeException(parser.getErrorMessage());			}			AST ast = parser.getAST();			PathExpr expr = new PathExpr(context);			treeParser.xpath(ast, expr);			if (treeParser.foundErrors()) {				throw new RuntimeException(treeParser.getErrorMessage());			}			long start = System.currentTimeMillis();			Sequence resultSeq = expr.eval(null, null);			if (!(resultSeq.getLength() == 0 || Type.subTypeOf(resultSeq.getItemType(), Type.NODE)))				throw new EXistException("select expression should evaluate to a node-set; got " +				        Type.getTypeName(resultSeq.getItemType()));			LOG.debug("found " + resultSeq.getLength() + " for select: " + selectStmt);			return (NodeList)resultSeq.toNodeSet();		} catch (RecognitionException e) {			LOG.warn("error while parsing select expression", e);			throw new EXistException(e);		} catch (TokenStreamException e) {			LOG.warn("error while parsing select expression", e);			throw new EXistException(e);		}	}