在[javascript]中将[object HTMLCollection]转换为字符串

Ank*_*kan 2 html javascript rest zimbra

我正在尝试使用从XML文件中提取的数据getElementByTagName并返回,HTML Collection Object但我需要这些数据来发送REST请求,因此我需要将HTML集合对象转换为字符串.怎么做到呢?

这里有更多信息:

com_zimbra_om.prototype._responseHandler=
        function(response){
                try{
                    sid = response.xml.getElementsByTagName("session_id");
                    this.login_user();
                    }catch(e){
                            this._showErrorMsg(e);
                            }
Run Code Online (Sandbox Code Playgroud)

使用此函数我试图session_id从REST响应中获取.这里sid(全局变量)是HTML集合对象.现在当我尝试在下一个函数中使用它时:

com_zimbra_om.prototype.login_user = function(){
var url = selected_server + 'services/UserService/loginUser?SID=' +
                                    sid + '&username='+
                                    selected_username +
                                    '&userpass=' + 
                                    selected_password;
                var request_url = ZmZimletBase.PROXY + AjxStringUtil.urlComponentEncode(url);
Run Code Online (Sandbox Code Playgroud)

所以我在这里使用sid我需要的字符串.

那么我应该如何将HTML Collection Object转换为字符串?

谢谢

Esa*_*ija 9

有了这些信息,我只能随身携带

var objectHTMLCollection = document.getElementsByTagName("div"),
    string = [].map.call( objectHTMLCollection, function(node){
        return node.textContent || node.innerText || "";
    }).join("");
Run Code Online (Sandbox Code Playgroud)