09-20-2017, 05:14 AM | #1 |
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
navpoint ids and epubcheck
Epubcheck complains if the navpoint ids in the toc.ncx begin with a digit.
e.g: Code:
<navPoint class="chapter" id="23b2a4fa-6968-47cd-a55b-68ec2650ccde" playOrder="3">
<navLabel>
<text>A Reminiscence of Dr Samuel Johnson</text>
</navLabel>
<content src="Text/story05.html"/>
</navPoint>
So I just prepended an X to all the ids and it passed epubcheck and seemed OK. Code:
id="X23b2a4fa-6968-47cd-a55b-68ec2650ccde" Last edited by AlanHK; 09-20-2017 at 05:18 AM. |
09-20-2017, 07:49 AM | #2 |
Grand Sorcerer
Posts: 27,554
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
The id attribute is required for the navPoint element. And yes, it must he unique. But it also has to conform to xml standards which require that ids do not start with a digit. The one you're dealing with was auto-generated (a urn guaranteed to be unique) by a program when building the toc. Unfortunately, those generated, unique urns sometimes start with number. I honestly don't know that they are "used" per se.
Sigil used to be susceptible to generating invalid ids like that, but that bug was fixed a while back. At least I think it was. At the time, the bugfix was about opf manifest ids rather than toc ids, but I assume the fix was applied to a general id-generating utility function. Last edited by DiapDealer; 09-20-2017 at 08:03 AM. |
Advert | |
|
09-20-2017, 08:17 AM | #3 |
Sigil Developer
Posts: 7,667
Karma: 5433388
Join Date: Nov 2009
Device: many
|
I think the routine we touched only dealt with manifest ids. We should at least look how the toc ids and nav ids are generated to verify they have the same fix.
|
09-20-2017, 10:44 AM | #4 |
Sigil Developer
Posts: 7,667
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Okay I checked src/Exporters/NCXWriter.cpp
and we use: m_Writer->writeAttribute("id", QString("navPoint-%1").arg(play_order)); So guaranteed to not begin with a digit. We do similar things in python3lib/ncxgenerator.py so our auto conversion routines from nav to ncx should be fine there. I also checked the nav for epub3: src/ResourceObjects/NavProcessor.cpp and it does not use "id" in a similar manner so we are okay there as well. I did see lots of calls to Gumbo's get_local_text_of_node() and there are no calls to simplified so we should probably add some simplify calls to the NavProcessor.cpp every time we use get_local_text_of_node just to be safe. That said a newline in an html document will just become a space and multiple spaces are condensed in html, so for the nav this may not matter too much. Last edited by KevinH; 09-20-2017 at 10:46 AM. |
09-20-2017, 10:52 AM | #5 |
Grand Sorcerer
Posts: 27,554
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I think the .simplified() additions I just pushed the other day (in Headings.cpp) are pretty central to all toc/nav production, but more wouldn't really hurt anything either.
Thanks for looking at the id generation. I didn't think uids were being introduced in the ncx that way, but I couldn't remember for sure. Last edited by DiapDealer; 09-20-2017 at 10:57 AM. |
Advert | |
|
09-20-2017, 12:03 PM | #6 | ||
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Since you're looking at the NCX code, according to the epub 2.0.1. specs:
Quote:
Quote:
I.e., if you didn't include the ncx-2005-1.dtd DOCTYPE declaration, you could also remove the playOrder attributes, which should theoretically simplify NCX updates. |
||
09-20-2017, 12:08 PM | #7 |
Sigil Developer
Posts: 7,667
Karma: 5433388
Join Date: Nov 2009
Device: many
|
@Doitsu
We actually use the playorder to generate the ids from. To change that now would be more work for no increase in validity. |
09-20-2017, 12:49 PM | #8 |
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
I know that Sigil doesn't make such ids in an epub it creates, but this was one I cannibalised; no idea what made it to begin with.
Anyway, wanted to confirm that nothing actually refers to this id, so I won't break anything if I change them as I did to shut epubcheck up. Last edited by AlanHK; 09-21-2017 at 12:16 AM. |
09-20-2017, 12:57 PM | #9 |
Grand Sorcerer
Posts: 27,554
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
No. As long as they're unique (and valid), no harm done. They can be anything. I've never even run into an issue with one that began with a digit on any reader (in any app), to tell the honest truth. But it's best to please Epubcheck when you can. I guess.
|
09-21-2017, 12:21 AM | #10 |
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
When it's giving me dozens of errors like this, I might miss the "real" errors that do have impact. (I wish there was a way to tell it to ignore specific errors.)
And while this one is just a personal project, if you are doing it for a client, passing Epubcheck may be a requirement. |
09-25-2017, 07:39 AM | #11 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
I've run into this issue before with the unique book id starting with a digit in the opf manifest that Kevin or DiapDealer fixed some while ago. I was the one who reported this problem way back when. What disappoints me is that when I just tested this current problem, Epupcheck still gives this weird error message for wrong ids in the toc.ncx:
Col: 72: ERROR(RSC-005): Error while parsing file 'value of attribute "id" is invalid; must be an XML name without colons'. This error message would be highly confusing for any indie guy trying to get his book to pass Epubcheck. That error message tells you nothing whatsover about the problem and is highly misleading. Just a suggestion, but would it be possible to implement a simple change in Sigil where, on opening any epub in Sigil, an automatic check of all the unique ids in the toc.ncx(with a helpful error message for the user if an id incorrectly starts with a digit)? Or another alternative would be to just update the Mend XHTML Source... feature to actually repair this problem automatically if it is found. I also realize that this problem has nothing to do with Sigil -- I'm only suggesting a solution that would perhaps help other Sigil users with this problem in the future. Last edited by slowsmile; 09-25-2017 at 07:44 AM. |
09-25-2017, 08:14 AM | #12 |
Grand Sorcerer
Posts: 27,554
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
No, we're not going to repair invalid ids automatically, and Sigil is no longer in the epub validation game itself. Validation is done by plugins. If you consider Epubcheck's error message to be unhelpful, you should consider reporting this to the Epubcheck developers.
Sigil's validation plugin framework offers plugin developers a way to create their own error-checking routines that go above and beyond what EpubCheck looks for (or how it describes a problem). Perhaps you can convince one to compile a list of extra checks/warnings into plugin that might be more helpful to neophytes. |
09-25-2017, 08:28 AM | #13 | |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Since you can use both Calibre Editor and Sigil, there's no point in adding this feature to Sigil. |
|
09-25-2017, 07:18 PM | #14 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
I've just reported the Epubcheck uuid error message problem on the IDPF Epubcheck issues list on Git Hub(Issue #795).
@Doitsu...Thanks for your info, which was quite useful to know. Last edited by slowsmile; 09-25-2017 at 11:58 PM. |
09-26-2017, 12:32 AM | #15 | ||
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
Also found this discussion on GitHub https://github.com/IDPF/epubcheck/is...ment-151267599 Quote:
As above, this has been reported there at least 5 times already, but it's a "wontfix". Last edited by AlanHK; 09-26-2017 at 12:53 AM. |
||
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
navPoint ID | bookwurm70 | Editor | 5 | 06-02-2014 11:39 PM |
Wohin gehört NavPoint „Anfang“? | praetor | Lounge | 3 | 11-09-2012 03:25 PM |
Web-based epubcheck upgraded to epubcheck 1.0.5 | kjk | ePub | 4 | 02-09-2010 09:53 PM |
Nested navPoint problem | Lemming | Calibre | 3 | 12-20-2009 11:24 AM |