Are you doing this for a specific EPUB or are you trying to make something more general purpose? In general the TOC file doesn’t always have a specific name, or might not even be present in EPUB 3. And TOC entries don’t always point to the beginning of an XHTML file.
You may want to consider implementing this as a plugin of an EPUB editor such as calibre or sigil.
|