Validation Example

 

Example 4.5. Validation error messages

In this example you will use the case where a DocBook listitem element does not match the rules of the docbookx.dtd. In this case running Validate Document will return the following error:

  E The content of element type "listitem" must
  match"(calloutlist|glosslist|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|anchor|
  bridgehead|remark|highlights|abstract|authorblurb|epigraph|
  indexterm|beginpage)+".

As you can see, this error message is a little more difficult to understand, so understanding of the syntax or processing rules for the DocBook XML DTD's "listitem" element is required. However, the error message does give us a clue as to the source of the problem, but indicating that "The content of element type "listitem" must match".

Luckily most standards based DTD's, XML Schema's and Relax NG schemas are supplied with reference documentation. This enables us 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 on the next validation test.