EPUB 3 package document
EPUB 3 OPF (package.opf)
The package document of an EPUB 3 book: metadata, manifest and spine, checked with the grammar and rules epubcheck uses.
About
Every EPUB 3 book has one package document (usually OEBPS/content.opf or package.opf) listing its metadata, every file in the book and the reading order. Stores and reading systems reject a book whose package document is broken.
Two layers are checked: the RELAX NG grammar of epubcheck, then its Schematron rules (unique identifier, exactly one nav item, refines targets, rendition properties and so on).
Good to know
- Drop the whole .epub on the validator's Upload tab to check the book file by file: container.xml, this package document, the NCX, and every XHTML, SVG and SMIL file of the manifest for well-formedness, plus the mimetype file and manifest files missing from the archive. CSS, fonts, links between files, media types and XHTML content rules are checked by epubcheck, not here.
- libxml2 mishandles the nested interleave of the original grammar and would reject a meta element placed between dc elements, which EPUB allows. The main file is a small wrapper by xmlvalid.com that includes package-30.rnc unchanged and writes that part as one flat interleave; both accept the same documents.
- The example is by xmlvalid.com.
Files
4 files · 16.2 KB-
package-30-flat.rnc main
-
package-30.rnc
-
mod/datatypes.rnc
-
mod/epub-prefix-attr.rnc
The validator loads all of these with their folder structure, so includes and imports resolve as published.
Business rules
Schematron · run in this order-
EPUB 3 package rules (epubcheck) epubcheck 5
The rules run after the schema check, only when the document matches the schema, and in your browser like the schema check (with SaxonJS by Saxonica). Each finding gives the line it points at.
Example document
package.opf · 1.2 KB · passes the schema and the rules
In CI and from code
The same schema by its name, epub-3-package, through the API.
npx @xmlvalid/cli validate "**/*.xml" --schema epub-3-package
- uses: xmlvalid/validate-action@v1
with:
files: "**/*.xml"
schema: epub-3-package
api-key: ${{ secrets.XMLVALID_API_KEY }}
curl https://xmlvalid.com/api/v1/validations \
-H "Authorization: Bearer $XMLVALID_API_KEY" \
-F document={{ $schema->example ?? 'document.xml' }} -F schema=epub-3-package
Free accounts get 100 API validations a month. On Pro, a URL monitor can check a published document against this schema every hour and email you when it breaks. More CI setups