augustl / js-epub

EPUB library for Javascript
http://ditrw.com/booktorious/
233 stars 29 forks source link

TypeError: 'undefined' is not an object (evaluating 'c.getElementsByTagName("rootfile")[0].getAttribute') #5

Closed mebibou closed 8 years ago

mebibou commented 12 years ago

Hey there, it seems like a very nice library. However, whenever I try to read a file from a servlet written in Java, I get the following error (Safari 5.1.2/Chrome 16.0.912.77): TypeError: 'undefined' is not an object (evaluating 'c.getElementsByTagName("rootfile")[0].getAttribute')

I have tried with Base64 encoding, without, but it still gives me the same error. What do you think could be the problem?

Thanks!

augustl commented 12 years ago

Can you post the EPUB that causes this error?

mebibou commented 12 years ago

Thanks for your quick reply! So I tried a few different books that I found on epubbooks.com, like:

kidino commented 12 years ago

Hello Augustl. I am getting this same error. And I believe it's because the JS-Zip didn't finish or simply skips the rest of the ePub content when unzipping. In my case, I realize that it unzips mimetype, META-INF and then done. At times it got to META-INF/container.xml. But others in the ePub was never read. So when JS-EPUB tries to read content.opf, because it was never loaded in data.

I tried from a number of ePubs including the two mebibou pointed out. I also read at your JS-ZIP that somebody solved it with your non-minified script. I tried both and still facing this. If you feel this a problem with the ZIP or encryption, I hope you can point out how to better zip the ePubs.

Any kind of help is appreciated.

jarodium commented 11 years ago

Does this have anything to do with the XMLSerializer ? I don't if it needs an external JS XML handler.

augustl commented 8 years ago

I just deprecated this project. A much better alternative exists now, that wasn't around when I originally created the project. Check it out :) https://github.com/futurepress/epub.js/