[xml/sgml-pkgs] Bug#686820: xmllint: Please make xmllint detect more bugs with indexterm ranges in docbook files

Petter Reinholdtsen pere at hungry.com
Thu Sep 6 10:04:18 UTC 2012

Package: libxml2-utils
Version: 2.7.8.dfsg-2+squeeze5

When checking docbook XML files, there are a few errors in the indexterm
entries that are undetected.  It will detect if there is a endofrange
entry without the corresponding startofrange.  It will also detect if
there are two startofrange with the same ID.  But it will not detect

 (1) if there is a startofrange without a endofrange.
 (2) if there are two endofrange with the same ID.

See the example docbook file for a demonstration.  This file got two
errors, and xmllint claim everything is OK.  I run it like this:

  xmllint --nonet --noout  --xinclude --postvalid  bad-indexterm.xml

Can xmllint be extended to detect these bugs too?  When adding lots of
indexterm entries it would be useful to get more help to find the bugs I
introduce. :)

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
<!-- Demonstrate insufficient indexterm checking by xmllint. -->
    <title>Example demonstrating xmllint index problem</title>
<indexterm id='idxone' class='startofrange'><primary>first index</primary></indexterm>
<indexterm startref='idxone' class='endofrange'/>
<indexterm startref='idxone' class='endofrange'/>
<indexterm id='idxtwo' class='startofrange'><primary>second index</primary></indexterm>
  <para>text is good</para>

Happy hacking
Petter Reinholdtsen

More information about the debian-xml-sgml-pkgs mailing list