XML Parser not readable in Firefox

I am parsing my XML file in HTML and it parses well when I run it in Chrome/Edge browsers, but when I run it in Firefox, it throws this error:

XML Parsing Error: not well-formed
Location: http://127.0.0.1:5500/List.xml
Line Number 21, Column 2:

This is my HTML where I parse it:

<script>
var xml = new XMLHttpRequest();
        xml.onreadystatechange = function () {
            if (xml.readyState == XMLHttpRequest.DONE) {
                var xmlData = xml.responseXML;
                if (!xmlData) {
                    xmlData = (new DOMParser()).parseFromString(xml.responseText, 'text/xml');
                    var PDF = xmlData.getElementsByTagName("PDF");
                    var web = PDF[0].getElementsByTagName("link")[0].firstChild.data;
                }
            }
        }

        xml.open('GET', 'List.xml', true);
        xml.send(null);
</script>
<?xml version = "1.0" ?>

<List>
    <PDF>
        <id>1</id>
        <link>https://www.mywebpage.com/AA.pdf</link>
    </PDF>
</List>

</xml> 

Answer

Your XML is not well-formed. Remove the last </xml> tag.

The <?xml version = "1.0" ?> construct is not a opening element tag that has to be closed. It is an XML declaration.