get xml node text
<p>I can't seem to find any solutions in JavaScript as I don't want to work with jQuery. I am trying to get the date text from an xml document. I have the following code, but I get the error that length cannot be read from undefined. What am I doing wrong?</p>

<pre><code>var request, xmldocument, date, xmlDate;
request = new XMLHttpRequest();
request.open("GET", "http://XXXXX/rss.php", true);
request.onreadystatechange = function() {
    if (request.readyState == 4) {
        // xml document
        xmldocument = request.responseXML;
        // dates from xml document
        date = xmldocument.getElementsByTagName("pubDate");
        // loop over dates
        for (count = 0; count &lt;= date.childNodes.length; count++) {
            // text of date node
            xmlDate = date.childNodes[i].nodeValue;
            // read out text
            console.log(xmlDate);
        }
    }
}
request.send();
</code></pre>
