0

I'm trying to fix a table of contents with the following code and am am getting this error:

"Error at line 20 at column 8: Opening and ending tag mismatch li line 0 and html"

This is confusing because the closing tag for li is , not html. And all the

  • tags are closed. Also, in an ebook, you don't simply have html file where there is a line 20.

    Here's the code:

    <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <html xmlns="http://www.w3.org/1999/xhtml"  
    xmlns:epub="http://www.idpf.org/2007/ops" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    
      <head>
        <title>Contents</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-  Type"/>
    <link href="../Styles/stylesheet.css" rel="stylesheet" type="text/css"/>
    <link href="../Styles/page_styles.css" rel="stylesheet"    type="text/css"/>
    </head>
      <body class="calibre">
        <h1 class="calibre1">Contents</h1>
        <ul class="calibre2" id="toc-style"><li class="calibre3">
        <body>
        <ol>
        <li><a class="calibre4" href="../Text/Flow_0_split_000.xhtml">Foreword/The Art of Correction</a></li>
        <li><a class="calibre4" href="../Text/Flow_0_split_001.xhtml">The Revelation of Anakum</a></li>
        <li><a class="calibre4" href="../Text/Flow_0_split_002.xhtml">Justice is Blind</a></li>
        </ol>
    
    </body>
    </html>
    
  • user26732
    • 329
    • 2
    • 10
    • What kind of tools are you using to edit your ebook? – Sekhemty May 20 '17 at 10:39
    • Quark export to ePub, ePub import to Calibre, Calibre convert to ePub (for line spacing and cover), Sigil for ToC tweaking. – user26732 May 21 '17 at 05:31
    • Calibre can automatically create a ToC for you, instead of having to edit its code manually; as others have pointed out, it is not correctly coded. Besides that, you might want to try to use just a program (Calibre editor or Sigil) instead of all these passages and conversions. – Sekhemty May 21 '17 at 13:50
    • I tried. Calibre treated a single footnote as a chapter and didn't recognize the other chapters. Nor would it let me correct or remove an existing ToC that was generated by another program that didn't let me edit the ToC either. That's why I had to break out Sigil in the first place. Now I have a nicely formatted iBooks Author project that apparently cannot be exported to ePub. Arrrgh. And yes, I used their template. – user26732 May 21 '17 at 14:22
    • If you use

      ...

      html headers for chapter titles only, and select the option to create entries for main headers, it will work. Having just a footnote recognized as a main entry sounds like your files are not coded with clean and proper html. A program can't interpret your intentions, giving it proper code is a responsibility of yours.
      – Sekhemty May 21 '17 at 14:39
    • Using html as an intermediate step isn't a bad idea. But the files were automatically coded by Quark which does not give you the ability to use html tags when exporting. Or even in the text. – user26732 May 21 '17 at 16:28
    • I really can't understand. If you know thay your problems are caused by some of the tools you use, can't you simply discard them and use something else? – Sekhemty May 21 '17 at 22:25
    • You are correct. I suppose I could pay for InDesign. As it is, I'm moving from tools that claim general functionality, but in this specific case they gag. Starting from a Word document to Vellum won't work, because Vellum won't handle footnotes. Quark can handle footnotes and promises ePub export, but the problems I've outlined are present. iBooks Author creates a .ipa file which can't export to ePub. I haven't tried Pandoc Word>ePub or InDesign or using an intermediate step. I thought fixing the xhtml ToC would be easy, but it's not. – user26732 May 22 '17 at 04:05
    • Like I said, Calibre is perfectly capable of handling this, you don't need to buy InDesign just for a table of contents... – Sekhemty May 22 '17 at 05:55
    • But it isn't. There are 47 footnotes. The first footnote was listed as if it were a Chapter in the ToC. The Quark-generated ToC remained in the text. The front matter disappeared. One whole Part disappeared. Forcing the ToC didn't help. Und und und. That is why I tried to futz with the xhtml code using Sigil. – user26732 May 23 '17 at 04:31
    • you are not even listening. Calibre CAN properly edit an epub. Use a tool only and not covert between many programs. Use headers properly. If Footnotes are treated as chapters and real chapters are not even recognised, you are not using the correct tags. You really need to learn how to code HTML correctly, you can't blame a program if you don't know how to use it. You already had all the answers, you are on your own now. – Sekhemty May 23 '17 at 06:46
    • You suggested I try to find another tool. I'm trying to find one that works. I've used Calibre on simple files without a problem; for some reason this one throws errors. Coding html is not an issue; coding xml is another story. If an ePub were a single html file beginning with and ending with it would be easy to fix the code. But it's not. – user26732 May 23 '17 at 16:28

    1 Answers1

    1

    The problem is that you have an open UL tag with no close tag. (and an extra body tag in strange place). Did you paste the code correctly into the Stack Exchange form?

    You might want to consider pasting the contents into the calibre editor or sigil editor and beginning from scratch. Or pasting it into word, removing all formatting except headings and using calibre to convert from MS Word to epub. Typically calibre generates the tocs from MS word pretty well.

    idiotprogrammer
    • 4,594
    • 13
    • 26
    • I don't see any
        tags in the above example. There's an
        tag which is closed. There's a ul class definition but no tag. Where do you see a tag?
      – user26732 May 21 '17 at 05:30
    • 1
      @user26732 Of course there is a UL tag it starts with <ul and has a class attribute calibre2. You may want to use this xhtml validator by w3c.org to find errors in your source (it indicates four of them), as you don't seem to be too familiar with valid XHTML syntax (and terminology). – Anthon May 21 '17 at 11:23
    • Agreed. I would be much happier with plain old html, but that's not what the tools are throwing at me. – user26732 May 21 '17 at 14:19