title: converting a [object HTMLCollection] into string in javascript
body: <p>I am trying to use data extracted from a XML file by <code>getElementByTagName</code> and it returns <code>HTML Collection Object</code> but I need this data for a sending a REST request so I need to get the HTML Collection Object to be converted into a string. How can it be done?</p>
  
  <p>Here's more information:</p>
  
  <pre><code>com_zimbra_om.prototype._responseHandler=
          function(response){
                  try{
                      sid = response.xml.getElementsByTagName("session_id");
                      this.login_user();
                      }catch(e){
                              this._showErrorMsg(e);
                              }
  </code></pre>
  
  <p>Using this function I am trying to get the <code>session_id</code> from a REST response. Here <code>sid</code> (global variable) is the HTML Collection Object. Now when I try to use this in the next function:</p>
  
  <pre><code>com_zimbra_om.prototype.login_user = function(){
  var url = selected_server + 'services/UserService/loginUser?SID=' +
                                      sid + '&amp;username='+
                                      selected_username +
                                      '&amp;userpass=' + 
                                      selected_password;
                  var request_url = ZmZimletBase.PROXY + AjxStringUtil.urlComponentEncode(url);
  </code></pre>
  
  <p>So here I am using <code>sid</code> which I need as a string.</p>
  
  <p>So how should I convert HTML Collection Object into string??</p>
  
  <p>Thanks</p>