How to check if input string is XML?
<p>Is there any way to check if a string entered is XML or not? </p>

<pre class="lang-js prettyprint-override"><code>function fetchData () {
    if (xmlString.value !== "") {   
        parser = new DOMParser;
        xmlDoc = parser.parseFromString(xmlString.value, 'text/xml');
    } else {
        outputHtml.value = "Please type your XML properly";
    }
}
</code></pre>

<p>Now I can only check if input is empty. </p>