Quantcast
Viewing latest article 27
Browse Latest Browse All 38

Web-based ePub validator adds Preflight and API

Image may be NSFW.
Clik here to view.
Valid EPUB

Our web tool for using the open-source epubcheck validator got a quick refresh:

Now includes epubpreflight results

EpubCheck’s lesser-known companion checks for additional issues like content documents that exceed 300K, which can’t be loaded on the Sony Reader. The complete (short!) list:

  • Content files that are empty or are >300k
  • Image files that are empty or are >10MB

Simple API service

This has been part of Bookworm for some time but I’m finally documenting it: there’s also a machine-readable API for the validator. It’s very simple — you get back an XML document indicating whether the file was valid, and if invalid, the list of errors.

Just POST an epub file as a series of bytes to http://threepress.org/epubcheck-service/ and look at the response. Here’s a sample interaction using curl, but you could use your favorite HTTP client.

Successful validation

$ curl --data-binary @pg345.epub http://threepress.org/epubcheck-service/
<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
   <is-valid>True</is-valid>
</rsp>

Invalid ePub

$ curl --data-binary @invalid.epub http://threepress.org/epubcheck-service/

<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
    <is-valid>False</is-valid>
    <errors>
        <error>ERROR: temp.epub/metadata.opf(6): attribute "files-as" from namespace "http://www.idpf.org/2007/opf" not allowed at this point; ignored</error>
        <error>ERROR: temp.epub/metadata.opf(9): unknown element "series_index" from namespace "http://www.idpf.org/2007/opf"</error>
     </errors>
</rsp>

Viewing latest article 27
Browse Latest Browse All 38

Trending Articles