#1117 DocBook 5.1b2 does not validate

other
closed-works-for-me
nobody
other (15)
5
2010-08-13
2010-08-12
Don Siders
No

Validation fails for a simple document using xmllint and the Relax schemas at http://www.docbook.org/xml/5.1b2/rng/.

Content:

<?xml version="1.0"?>
<topic xml:id="foobar" class="reference" xmlns="http://docbook.org/ns/docbook">
<title></title>
<para/>
<section>
<title></title>
<para></para>
</section>
</topic>

Command:

xmllint --relaxng docbook.rng docbook51topic.xml

Error messages:

<?xml version="1.0"?>
<topic xmlns="http://docbook.org/ns/docbook" xml:id="foobar" class="reference">
<title/>
<para/>
<section>
<title/>
<para/>
</section>
</topic>
Did not expect element topic there
Expecting element abstract, got topic
Expecting element audiodata, got topic
Expecting element example, got topic
Expecting element legalnotice, got topic
docbook51topic.xml fails to validate

Discussion

  • Don Siders
    Don Siders
    2010-08-12

    DocBook 5.1b2 topic file

     
    Attachments
  • The xmllint error message is misleading, to say the least. With Jing, the output is as follows:

    java -jar c:/java/jing-20090818/bin/jing.jar rng/docbook.rng topic.xml
    c:\doctypes\docbook\5.1b2\topic.xml:2:80: error: attribute "class" not allowed here; expected attribute "annotations", "arch", "audience", "condition", "conformance", "dir", "label", "linkend", "ns:actuate", "ns:arcrole", "ns:href", "ns:role", "ns:show", "ns:title", "ns:type", "os", "remap", "revision", "revisionflag", "role", "security", "status", "type", "userlevel", "vendor", "version", "wordsize", "xml:base", "xml:lang" or "xreflabel" (with xmlns:ns="http://www.w3.org/1999/xlink")

    MSV reports the same error:

    java -Xss512K -jar c:/java/msv-20081113/msv.jar rng/docbook.rng topic.xml
    start parsing a grammar.
    warnings are found. use -warning switch to see all warnings.
    validating topic.xml
    Error at line:2, column:80 of file:///c:/doctypes/docbook/5.1b2/topic.xml
    unexpected attribute "class"

    the document is NOT valid.

    Both xmllint, Jing, and MSV report the document as valid if the "class" attribute is changed to "type".

     
  • Don Siders
    Don Siders
    2010-08-12

    Thanks for the feedback. I was working from the specification in the RFE:

    Here are is the proposed design for topic:
    ...
    2. A topic type is indicated by a class attribute value.
    For example, "task", "reference", "concept", etc.

     
  • I suppose that it could have been more clearly communicated, but at some point it was decided that the "class" attribute in the original RFE should be changed to "type".
    See http://www.docbook.org/tdg51/en/html/topic.html.

     
  • Don Siders
    Don Siders
    2010-08-13

    Thanks for the quick responses.

    I thought I had found an error in the schema. Works as documented.

     
  • Don Siders
    Don Siders
    2010-08-13

    • status: open --> closed-works-for-me