String docColl = doc.substring( 0, doc.lastIndexOf( '/' ) ); CollectionImpl temp = (CollectionImpl) DatabaseImpl.readCollection( docColl, collection.getClient(), null );
    public Resource getResource( long pos ) throws XMLDBException {        if ( pos >= resources.size() )            return null;        // node or value?        if ( resources.elementAt( (int) pos ) instanceof Vector ) {            // node            Vector v = (Vector) resources.elementAt( (int) pos );            String doc = (String) v.elementAt( 0 );            String s_id = (String) v.elementAt( 1 );            String docColl = doc.substring( 0, doc.lastIndexOf( '/' ) );            CollectionImpl temp = (CollectionImpl)                DatabaseImpl.readCollection( docColl, collection.getClient(), null );            XMLResource res =                new XMLResourceImpl( temp, doc, s_id, indentXML, encoding );            return res;        }        else if ( resources.elementAt( (int) pos ) instanceof Resource )            return (Resource) resources.elementAt( (int) pos );        else {            // value            XMLResource res = new XMLResourceImpl( collection, Long.toString( pos ),                null, indentXML, encoding );            res.setContent( resources.elementAt( (int) pos ) );            return res;        }    }