我正在使用https://github.com/augustl/js-epub解析 .epub 文件。但我收到错误为“XML 解析错误:未找到元素”。我在第 3 步之前没有问题,它失败了在后处理步骤中。我正在使用以下代码
$(document).ready(function(){
$('#something').html('fetching');
$.ajax({
url: "alice.epub",
complete: function(response, status, request) {
var the_zip = new JSUnzip(response.responseText);
$('#something').html('finished with ' + status);
console.log("is it zip?" + the_zip.isZipFile());
var epub = new JSEpub(response.responseText);
epub.processInSteps(function (step, extras) {
var msg = '';
console.log(step);
if (step === 1) {
msg = "Unzipping";
} else if (step === 2) {
msg = "Uncompressing " + extras;
}
else if (step === 3) {
msg = "Reading OPS";
}
else if (step === 4) {
msg = "Post processing";
alert(msg);
}
else if (step === 5) {
msg = "Finishing";
alert('done!');
}
else {
msg = "Error!";
}
$('#something').html(msg);
});
}
});
});
请谁能告诉我上面代码中的错误。