rem: var theUri = document.getElementById(g_cq_uri).value; 
add: var theUri = trim(document.getElementById(g_cq_uri).value); 
context: function cqExport(theForm) {    // export store the buffer state into the value of form element g_cq_uri    // if the g_cq_uri does not exist, we must create it in one XQuery,    // then populate it in another    // the simplest way is to create temporary form elements, and submit them    // TODO export non-default options (rows, cols, etc), export them    var theUri = document.getElementById(g_cq_uri).value;    if (theUri) {        var theQuery =            'xdmp:document-insert("' + theUri + '",'            + '<' + g_cq_buffers_area_id + ' id="' + g_cq_buffers_area_id + '">';        // save buffers        // childNodes.length will return some non-buffer elements, too!        var buf = null;        // parent of all the textareas        var theParent = document.getElementById(g_cq_buffers_area_id);        for (var i = 0; i < theParent.childNodes.length; i++) {            buf = getBuffer(i);            if (buf != null) {                theQuery += '<' + g_cq_buffer_basename + '>'                    // TODO xml-escape, instead?                    + encodeURIComponent(getBuffer(i).value)                    + '</' + g_cq_buffer_basename + '>'                    + "\n";            }        }        // save history too        var listNode = getQueryHistoryListNode(false);        if (!listNode) {            debug.print("cqExport: null listNode");        } else {            var historyQueries = listNode.childNodes;            var historyLength = historyQueries.length;            for (var i = 0; i < historyLength; i++) {                theQuery += '<' + g_cq_history_basename + '>'                    // TODO xml-escape, instead?                    + encodeURIComponent(historyQueries[i].firstChild.nodeValue)                    + '</' + g_cq_history_basename + '>'                    + "\n";            }        }        theQuery += '</' + g_cq_buffers_area_id + '>)'            + ', "exported ' + theUri + '"';        // set the current database to null,        // so we save to the default db?        theDatabase = document.getElementById(g_cq_eval_list_id);        oldDatabase = theDatabase.value;        theDatabase.value = null;        submitForm(theForm, theQuery, "text/html");        debug.print("cqExport: preserving selected database " + oldDatabase);        theDatabase.value = oldDatabase;    } // if theUri} // cqExport
meta: 952	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/952/80df44989b199bf06ecaf6b380ef0d6ae363df5b/cq.js/clean/cq.js