我正在使用https://github.com/augustl/js-epub解析.epub file.but,我得到的错误是"XML parsing error :no element found".i直到步骤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);
});
}
});
});请告诉我上面代码中的错误。
发布于 2012-11-25 02:49:43
您有没有尝试过js-epub的validate-function?
var vali = epub.validate();如果一些值是“未定义的”,你的控制台现在应该抛出一个异常;
顺便说一下..。检查js-epub.js代码时-第15行缺少“新的”-tag(充气)...也许这就解决了你的问题。
编辑:如果你解决了这个问题,分享答案会很好。
https://stackoverflow.com/questions/12985660
复制相似问题