/** * Write a manifest. * * @param serializer the XML serialiser to write the manifest to * @param book the book to write the manifest for * @throws IOException if an I/O error occurs */ private static void writeManifest(final XmlSerializer serializer, final Book book) throws IOException { serializer.startTag(NAMESPACE_OPF, OPFElements.MANIFEST); if (book.isNcx()) { serializer.startTag(NAMESPACE_OPF, OPFElements.ITEM); serializer.attribute(PREFIX_EMPTY, OPFAttributes.ID, book.getNcxId()); serializer.attribute(PREFIX_EMPTY, OPFAttributes.HREF, book.getNcxHref()); serializer.attribute(PREFIX_EMPTY, OPFAttributes.MEDIA_TYPE, book.getNcxMediaType()); serializer.endTag(NAMESPACE_OPF, OPFElements.ITEM); } for (Resource resource : getResourcesSortedById(book)) { writeItem(serializer, book, resource); } serializer.endTag(NAMESPACE_OPF, OPFElements.MANIFEST); }