$(function() {
  $(document).on('dragenter', function (event) {
      event.stopPropagation();
      event.preventDefault();
  });

  $(document).on('drop', function (event) {
      event.stopPropagation();
      event.preventDefault();
      
      var files = event.originalEvent.dataTransfer.files;
      for (var i = 0; i < files.length; ++i) {
        var fileReader = new FileReader();
        fileReader.onload = function (readerEvent) {
          var binaryString = readerEvent.target.result;
          var xmlDoc = $.parseXML(binaryString);
          showResultXml(xmlDoc);
        };
  
        if (files[i])
          fileReader.readAsBinaryString(files[i]);
      }
      
      
  });
  
  $(document).on('dragover', function( event ) {
      event.preventDefault();
  });
});

