-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some browsers do not support <?xml version="1.1"?> tag #467
Comments
We ran into this issue too, specifically with Firefox, which was not loading certain books. In our case the books were EPUB version 2. According to OPF 2.0 spec: "An XML Document is a complete and valid XML document as defined in XML 1.0 (Fourth Edition) (http://www.w3.org/TR/2006/REC-xml-20060816/)." We didn't have the option of going back to the vendor to have the EPUBs corrected, so we did it ourselves. After clearing this error the books loaded. When I was debugging, I did see console errors that hinted at the problem. Shortly before all console messages stopped, Firefox reported "XML declaration not well-formed" for what I believe was the OPF file. I agree Readium could enhance this error message. In fact, it seemed to fail to process the exception. The final console error was "TypeError: e is undefined" in a file I can't identify because I am looking at a screenshot of the console output, but it is definitely a readium file. Note that we are using a Sep 2, 2015 version of master, which is far behind HEAD now. |
What I ended up doing was patching the zipReader -- at the point where the file contents have been extracted from the zip file, replace any 1.1 declarations with 1.0 declarations. We will be asking our publishers to send us files with the declaration as 1.0; but a number of my test files were using 1.1 and this was the quickest way to get past this particular issue. If you're interested, I can post the code that I modified. |
Yes I would like to see the code, just to learn more about Readium. We don't actually need it, though, because we fixed the declarations in our EPUBs. Maybe this is an option for you as well? That way you won't need to deal with patches that would be overwritten or even possibly invalidated when updating Readium from upstream. Zip 3.0 by Info-ZIP is available on Mac OS X on the command-line. Following instructions from Epub Format Construction Guide - HXA7241 - 2007:
The flags being used (see http://www.info-zip.org/mans/zip.html):
We tested the correctness of this method in various ways:
So that's an option you might want to consider. |
Thank you for this bug report. I am able to reproduce on Windows 10 with Edge, Internet Explorer, Firefox (only Chrome works with |
Fixed in the readium/readium-cfi-js#45 |
I would appreciate if you could test the "live demo" link in your browsers, thanks! :) |
We just ran into this same issue. Is the plan to merge this as a permanent work around or should I fix it on our own readium branch? |
The feature/DOMParser branches (see comment above: #467 (comment) ) implement support for non-XML HTML too, so maybe you only need the XML 1.1 fix? |
PS: the XML1.1 fix basically boils down to XmlParse.preprocess() |
We have tracked down that our problem book slipped through very early before we forced everything through EPUB check. I'll just go ahead and implement a 1.1 fix in our branch. The issue is always "it works in iBooks", so failing EPUB check does not mean a whole lot to the authors it seems. |
@matwood could you please let us know where in your fork's code you patched the XML 1.1 issue? (I am asking because |
@danielweck Here is the fix I put in place on BiblioLabs fork. I added some better logging since cross browser error handling is hard with the parse function. If you want I can cherry pick it into the readium branch. |
I have some books which contain xml tags specified like this:
At the present, I'm getting around this by patching the code to replace "1.1" with "1.0". I think eventually we'll deal with this at the time we acquire the books from the publishers, either by asking them to package them with strictly "1.0", or by replacing the version number before we process the books and put them online.
So, I'm not sure whether you want to patch readium to make this change, or leave it as an issue for content providers. If you're leaving it to content providers, you may want to trap the error and log it to the console, so that users will better understand what is going on. I think that, without some sort of patch, the code simply fails without any diagnostics.
The text was updated successfully, but these errors were encountered: