if ( !( query.startsWith( "document(" ) || query.startsWith( "collection(" ) ) ) { if ( collection.getName().equals( "/" ) ) query = "document(*)" + query; else query = "collection('" + collection.getPath() + "')" + query; } byte[] qdata = null; System.out.println("query: " + query); try { qdata = query.getBytes( "UTF-8" ); } catch ( UnsupportedEncodingException e ) { qdata = query.getBytes(); } try { Vector params = new Vector(); params.addElement( qdata ); Vector result = (Vector) collection.getClient().execute( "query", params ); System.out.println("query finished."); return new ResourceSetImpl( collection, result, indentXML, encoding ); } catch ( XmlRpcException xre ) { throw new XMLDBException( ErrorCodes.VENDOR_ERROR, xre.getMessage(), xre ); } catch ( IOException ioe ) { throw new XMLDBException( ErrorCodes.VENDOR_ERROR, ioe.getMessage(), ioe ); } }
return query(query, null); }
    public ResourceSet query( String query ) throws XMLDBException {        if ( !( query.startsWith( "document(" ) || query.startsWith( "collection(" ) ) ) {            if ( collection.getName().equals( "/" ) )                query = "document(*)" + query;            else                query = "collection('" + collection.getPath() + "')" + query;        }        byte[] qdata = null;        System.out.println("query: " + query);        try {            qdata = query.getBytes( "UTF-8" );        } catch ( UnsupportedEncodingException e ) {            qdata = query.getBytes();        }        try {            Vector params = new Vector();            params.addElement( qdata );            Vector result = (Vector) collection.getClient().execute( "query", params );            System.out.println("query finished.");            return new ResourceSetImpl( collection, result, indentXML, encoding );        } catch ( XmlRpcException xre ) {            throw new XMLDBException( ErrorCodes.VENDOR_ERROR, xre.getMessage(), xre );        } catch ( IOException ioe ) {            throw new XMLDBException( ErrorCodes.VENDOR_ERROR, ioe.getMessage(), ioe );        }    }