Roccokain, I just went through this yesterday. Here's what I learned.
- All ids must be unique within an epub book. Don't bother making IDs unique within all <img> tags, or all <h1> tags, just make them unique within the whole book across all tags.
- All ids must begin with a letter.
- All filenames in content.opf or toc.ncx, like XHTML and CSS files, must begin with a letter.
- The mimetype file is case sensitive, it MUST be in all lowercase, with no byte order marker, and no carriage return at the end of the single line inside it.
- The mimetype file must not be compressed within the EPUB, and MUST be the first file. Only info-zip does this correctly AFAIK.
- Just because an ereader can read your EPUB does not mean it will pass validation.
And last, the BookId value of the id attribute in content.opf is case sensitive. Here's a correct tag:
<dc:identifier id="BookId" opf:scheme="ISBN">1223456988</dc:identifier>