https://github.com/wcandillon/cloud9-xquery/blob/master/plugins-client/ext.xquery/xquery.js