I'm trying to upload an XML file in the browser then parse the XML. On the uploaded file i can see the size correct, but it looks like have no data.
$('#xmlForm').submit(function(event) {
event.preventDefault();
var selectedFile = document.getElementById('input').files[0];
var parser = new DOMParser();
var doc = parser.parseFromString( selectedFile, "text/xml");
console.log(doc);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form id="xmlForm">
<input type="file" id="input">
<input type="submit">
</form>
The parser basically says to me: "The document is empty"
What am i missing?