Vigneshwaren
Vigneshwaren

Reputation: 1393

element chapter: validity error : Element chapter content does not follow the DTD, expecting

I have openembedded that has a docs directory and the README instructs me to run

make <type>

type can be pdf,dvi, html,txt, etc etc

xsltproc and docbook-utils are required to generate the documentation. Both are installed.

U have make pdf and the error generated was:

./usermanual.xml:91: element chapter: validity error : Element chapter content
 does not follow the DTD, expecting (beginpage? , chapterinfo? , (title , 
subtitle? , titleabbrev?) , (toc ...
title CDATA CDATA CDATA CDATA CDATA CDATA CDATA CDATA CDATA CDATA CDATA CDATA 
CDATA CDATA CDATA ) 
Document ./usermanual.xml does not validate
make: *** [lint] Error 3

I have absolutely 0-experience with XML files, dtdfiles. And I suspect a clash in version of docbook-utils I have and the source requires.

Upvotes: 1

Views: 3064

Answers (1)

helderdarocha
helderdarocha

Reputation: 23627

The error message is truncated, so it's not possible to know exactly what the requirements for the <chapter> element are, but it says that the contents of your <chapter> element do not match the DTD and because of that will not validate. It details the problem stating that the <chapter> element requires certain elements, in a certain order.

The commas in the error message mean a sequence. From the part of the error message that is shown above it is possible to know that, inside a <chapter> element:

  • You can have zero or one <beginpage> elements, and if present, it must come first.
  • You can have zero or one <chapterinfo> elements, and if present, it must come before the other elements but after <beginpage> (if present).
  • Following <beginpage> and <chapterinfo>, you must have a <title> and you can have at most one <subtitle> or <titleabbrev>.

If any of the rules above are not being followed in your source XML, validation will fail.

The rest of the DTD description of the message seems to be abbreviated, so it's not possible to conclude anything. You should check the full DTD to know what is wrong. It's not so difficult to read a DTD. Most ot the time you just have to understand sequences which are comma separated names: <!ELEMENT name (title?, first, middle*, last)> (name allows zero or one title, must have a first, may have zero or unbounded middle and must have last, in this order), and choices which are separated by |: <!ELEMENT contact (email | phone)> (contact must contain either email or phone) or <!ELEMENT contact (email | phone)*> (contact can be empty, can contain many choices of email or phone, in any order).

You might want to read a quick DTD tutorial.

Upvotes: 2

Related Questions