satorumurmur / bibi

Bibi | EPUB Reader on your website.
https://bibi.epub.link
MIT License
843 stars 123 forks source link

OPF file parse don't support opf namespace #97

Open zjzdy opened 3 years ago

zjzdy commented 3 years ago

I have some epub's content.opf just like:

<?xml version='1.0' encoding='UTF-8' standalone='no' ?>
<opf:package version="2.0" unique-identifier="BookId" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <opf:metadata>
    <dc:identifier id="BookId" opf:scheme="UUID">b4a6b89b-c178-45a4-9ee8-701c851bf494</dc:identifier>
    <dc:title>XXXXX</dc:title>
    <dc:creator opf:role="aut" opf:file-as="xxx"> Xxx</dc:creator>
    <opf:meta />
  </opf:metadata>
  <opf:manifest>
    <opf:item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" />
    <opf:item id="chapter" href="Text/chapter.xhtml" media-type="application/xhtml+xml" />
    <opf:item id="cover" href="Text/cover.xhtml" media-type="application/xhtml+xml" />
    <opf:item id="main" href="Styles/main.css" media-type="text/css" />
  </opf:manifest>
  <opf:spine toc="ncx">
    <opf:itemref idref="cover" />
    <opf:itemref idref="chapter" />
  </opf:spine>
  <opf:guide>
    <opf:reference type="cover" href="Text/cover.xhtml" title="cover" />
  </opf:guide>
</opf:package>

Error happen on __src/bibi/resources/scripts/bibi.heart.js line 779:

const _Package  = Doc.getElementsByTagName('package' )[0];
zjzdy commented 3 years ago

I use a hack method to fix the error: change getElementsByTagName('xxx') to getElementsByTagNameNS("*", "xxx")

satorumurmur commented 3 years ago

Thank you very much. I will consider the support in the next version.