.ncx

EPUB (short for electronic publication; sometimes styled ePub) is a free and open e-book standard by the International Digital Publishing Forum (IDPF). Files have the extension .epub - wikipedia

The NCX file (Navigation Control file for XML), traditionally named toc.ncx, contains the hierarchical table of contents for the EPUB file - wikipedia

The specification for NCX was developed for Digital Talking Book (DTB), is maintained by the DAISY Consortium, and is not a part of the EPUB specification. The NCX file has a mimetype of:

application/x-dtbncx+xml

An example .ncx file:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd"> <ncx version="2005-1" xml:lang="en" xmlns="http://www.daisy.org/z3986/2005/ncx/"> <head> </head> <docTitle> </docTitle> <docAuthor> </docAuthor> <navMap> </navMap> </ncx>

Of note here is that the values for the docTitle, docAuthor, and meta name="dtb:uid" elements should match their analogs in the OPF file.

<head> <!-- The following four metadata items are required for all NCX documents, including those that conform to the relaxed constraints of OPS 2.0 --> <meta name="dtb:uid" content="123456789X"/> <!-- same as in .opf --> <meta name="dtb:depth" content="1"/> <!-- 1 or higher --> <meta name="dtb:totalPageCount" content="0"/> <!-- must be 0 --> <meta name="dtb:maxPageNumber" content="0"/> <!-- must be 0 --> </head>

Also, the meta name="dtb:depth" element is set equal to the depth of the navMap element.

<docTitle> <text>Pride and Prejudice</text> </docTitle>

<docAuthor> <text>Austen, Jane</text> </docAuthor>

navPoint's content element points to a content document listed in the manifest and can also include an element identifier (e.g. #section1).

<navMap> <navPoint class="chapter" id="chapter1" playOrder="1"> <navLabel><text>Chapter 1</text></navLabel> <content src="chapter1.xhtml"/> </navPoint> </navMap>

navLabel's content is the text that appears in the table of contents generated by reading systems that use the .ncx.

navPoint elements can be nested to create a hierarchical table of contents.