Search code examples
objective-ciosipadepub

How do I parse the toc.ncx file within an ePub document and display its hierarchy?


I have my application to read and display an ePub file almost ready.

What I am looking now into is, if my table of contents for the book has a hierarchical structure for chapters, topics and subtopics, how do I parse the toc.ncx file (which has an XML structure), and load the data in a UITableView while preserving the hierarchical structure?


Solution

  • You can use NSXMLParser to parse the toc.ncx file. It's pretty straight forward, you can find the documentation here.