Hashtable namespaces = (Hashtable)parameters.get(RpcAPI.NAMESPACES); if(namespaces != null && namespaces.size() > 0) { for(Iterator i = namespaces.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry)i.next(); context.declareNamespace((String)entry.getKey(), (String)entry.getValue()); } }
	protected PathExpr compile(User user, DBBroker broker, String xquery,			Hashtable parameters) throws Exception {		String baseURI = (String) parameters.get(RpcAPI.BASE_URI);		XQueryContext context = new XQueryContext(broker);		context.setBaseURI(baseURI);		LOG.debug("compiling " + xquery);		XQueryLexer lexer = new XQueryLexer(new StringReader(xquery));		XQueryParser parser = new XQueryParser(lexer, false);		XQueryTreeParser treeParser = new XQueryTreeParser(context);		parser.xpath();		if (parser.foundErrors()) {			throw new EXistException(parser.getErrorMessage());		}		AST ast = parser.getAST();		PathExpr expr = new PathExpr(context);		treeParser.xpath(ast, expr);		if (treeParser.foundErrors()) {			throw new EXistException(treeParser.getErrorMessage());		}		return expr;	}