I have a website I'm coding that is supposed to grab some XML from an external site and parse it, but it's giving me a typeError: xmlDoc is null. Not sure what's wrong and I was wondering if anyone could help.

Here's teh code:

EDIT: added changes

```
        function loadXML()
    {

        var XMLHttpRequestObject = false;
        if (window.XMLHttpRequest) {
            XMLHttpRequestObject = new XMLHttpRequest();
            XMLHttpRequestObject.overrideMimeType("text/xml");
            console.log("XML HTTP Request, xml override.");

        }
         else if (window.ActiveXObject) {
            XMLHttpRequestObject = new
            ActiveXObject("Microsoft.XMLHTTP");
            console.log("ActiveXObject xml request.");
        }

        if(XMLHttpRequestObject) {
            XMLHttpRequestObject.open("GET", xmlLink, true);

            XMLHttpRequestObject.onreadystatechange = function() {
              if (XMLHttpRequestObject.readyState == 4) {
                // Load complete
                var xmlDocument = XMLHttpRequestObject.responseXML;
                parseXML(xmlDocument);
              }
            };

            XMLHttpRequestObject.send(null);
        }
    }

    function parseXML(xmlDoc){
        console.log(xmlDoc);
        var test1 = xmlDoc.getElementsByTagName('icon');
    }

```