Manipulating ckeditor data with jQuery

I'm working on a project that utilizes CKeditor and need to manipulate the data it contains.  Since I'm familiar with jQuery and it's fairly efficient at doing that sort of thing, rather than figuring out how CKeditor manipulates things internally, I wanted to, at least to get started, access things in jQuery.  There isn't a lot of information out there on the best way to do that.  Here's what I figured out – it seems to work pretty well:

    var editor = theeditor();
    var contents = $("<div id='specialwrapperthing'>" + editor.getData() + "</div>");

    .... hack away with jQuery ....
    editor.setData(contents.html());

Basically, you just wrap up what the editor hands you in terms of the data, hack away on it, and then put the HTML back into the editor.