title: has no method 'getElementsByTagName' error makes no sense
body: <p>i alert(xmldoc) in it is there? i dont understand
  here the code:</p>
  
  <pre><code>function getChatText()
  {
     if (receiveReq.readyState == 4 || receiveReq.readyState == 0) 
     {
        receiveReq.open("GET", 'getChat.php', true);
        receiveReq.onreadystatechange = handleReceiveChat; 
        receiveReq.send(null);
     }
  }   
  
  function handleReceiveChat()
  {
     if (receiveReq.readyState == 4)
     {
        var chat_div = document.getElementById('div_chat');
        var xmldoc = receiveReq.responseText;
        alert(xmldoc);
        var message_nodes = xmldoc.getElementsByTagName("message"); 
        var n_messages = message_nodes.length
        //more code here
     }
  }
  </code></pre>
  
  <p>part of getChat.php looks like this:</p>
  
  <pre><code>&lt;?php
  //code here
    $xml = '&lt;?xml version="1.0" ?&gt;';
    $sql = "SELECT message_id, user_name, message, date_format(post_time, '%h:%i') as post_time" . 
      " FROM message WHERE chat_id = " . db_input($_GET['chat']) ;
    $message_query = db_query($sql);
    while($message_array = db_fetch_array($message_query)) 
    {
  $xml .= '&lt;message&gt;';
      $xml .= '&lt;message_id id= "' . $message_array['message_id'] . '"&lt;/message_id&gt;';
  $xml .= '&lt;user&gt;' . htmlspecialchars($message_array['user_name']) . '&lt;/user&gt;';
  $xml .= '&lt;text&gt;' . htmlspecialchars($message_array['message']) . '&lt;/text&gt;';
  $xml .= '&lt;time&gt;' . $message_array['post_time'] . '&lt;/time&gt;';
  $xml .= '&lt;/message&gt;';
    }
  }
  echo $xml;
  ?&gt;
  </code></pre>
  
  <p>the exact error is on:  </p>
  
  <pre><code>var message_nodes = xmldoc.getElementsByTagName("message"); 
  </code></pre>
  
  <p>and states:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Object <code>&lt;?xml version="1.0" ?&gt;&lt;message&gt;&lt;message_id id= "1"&lt;/message_id&gt;&lt;user&gt;Me, ME, me and mE &lt;/user&gt;&lt;text&gt;123&lt;/text&gt;&lt;time&gt;09:14&lt;/time&gt;&lt;/message&gt;</code> has no method 'getElementsByTagName' </p>
  </blockquote>
  
  <p>can some one please explain this?
  thank you</p>