Validation Example - A DocBook Validation Error
In the following DocBook 4 document, the content of the listitem
element
does not match the rules of the DocBook 4 schema (docbookx.dtd
).
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.docbook.org/xml/4.4/docbookx.dtd"> <article> <title>Article Title</title> <sect1> <title>Section1 Title</title> <itemizedlist> <listitem> <link>a link here</link> </listitem> </itemizedlist> </sect1> </article>
The Validate Document action will return the following error:
Unexpected element "link". The content of the parent element type must match "(calloutlist|glosslist|bibliolist|itemizedlist|orderedlist|segmentedlist|simplelist |variablelist|caution|important|note|tip|warning|literallayout|programlisting |programlistingco|screen|screenco|screenshot|synopsis|cmdsynopsis|funcsynopsis |classsynopsis|fieldsynopsis|constructorsynopsis|destructorsynopsis|methodsynopsis |formalpara|para|simpara|address|blockquote|graphic|graphicco|mediaobject|mediaobjectco |informalequation|informalexample|informalfigure|informaltable|equation|example|figure |table|msgset|procedure|sidebar|qandaset|task|anchor|bridgehead|remark|highlights |abstract|authorblurb|epigraph|indexterm|beginpage)+".
This error message is a little more difficult to understand, so understanding of the
syntax
or processing rules for the DocBook XML DTD listitem
element is recommended.
However, the error message does offer a clue as to the source of the problem, indicating
that
The content of element type must match
.
Fortunately, most standards-based DTDs, XML Schemas, and Relax NG schemas are supplied
with
reference documentation. This enables you to lookup the element and read about it.
In this
case, you should learn about the child elements of listitem
and their nesting
rules. Once you have correctly inserted the required child element and nested it in
accordance
with the XML rules, the document will become valid.