}
    protected ResourceSet doQuery(String query, DocumentSet docs, NodeSet context)     throws XMLDBException {        try {            XPathLexer lexer = new XPathLexer( new StringReader( query ) );            XPathParser parser = new XPathParser( brokerPool, user, lexer );            PathExpr expr = new PathExpr(brokerPool);            parser.expr( expr );            LOG.info( "query: " + expr.pprint() );            long start = System.currentTimeMillis();            if ( parser.foundErrors() )                throw new XMLDBException( ErrorCodes.VENDOR_ERROR,                    parser.getErrorMsg() );            docs = (docs == null ? expr.preselect() : expr.preselect( docs ));            if ( docs.getLength() == 0 )                return null;            Value resultValue = expr.eval( docs, context, null );			LOG.info( expr.pprint() + " found: " + resultValue.getLength() + " in " +				( System.currentTimeMillis() - start ) + "ms." );            LocalResourceSet result =                new LocalResourceSet( user, brokerPool, collection,                resultValue, indentXML, encoding, saxDocumentEvents,                createContainerElements );            return result;        } catch ( antlr.RecognitionException re ) {            throw new XMLDBException( ErrorCodes.VENDOR_ERROR, re.getMessage(), re );        } catch ( antlr.TokenStreamException te ) {            throw new XMLDBException( ErrorCodes.VENDOR_ERROR, te.getMessage(), te );        } catch ( PermissionDeniedException e ) {            throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, e.getMessage(), e );        } catch( EXistException e ) {	    throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage(), e );	}    }