GNOME Bugzilla – Bug 131545
xmllint: no line numbers in --dtdvalid validation output
Last modified: 2009-08-15 18:40:50 UTC
I have document, doc.xml, which contains no DOCTYPE declaration. I run the following command: xmllint --dtd-valid http://foo.bar/baz.dtd doc.xml In the output, I get validity error messages, but without line numbers. For example: Element formalpara content does not follow the DTD, expecting (title , indexterm* , para), got (title procedure) On the other hand, if I put a DOCTYPE in doc.xml and run xmllint with the --valid option, I get output like this: doc.xml:190: element formalpara: validity error : Element formalpara content does not follow the DTD, expecting (title , indexterm* , para), got (title itemizedlist) <literal>-unlockServer</literal>.</para></listitem></itemizedlist></formalpara> ^ That is, the output includes line numbers that I can use to identify where the validity errors are in doc.xml. Without line numbers, I can't find the errors. Is it possible to have --dtd-valid output include line numbers?
Seems to work for me: paphio:~/XML -> cat tst3.dtd <!ELEMENT article EMPTY> paphio:~/XML -> cat tst3.xml <article>foo</article> paphio:~/XML -> xmllint --dtdvalid tst3.dtd tst3.xml <?xml version="1.0"?> <article>foo</article> tst3.xml:1: element article: validity error : Element article was declared EMPTY this one has content Document tst3.xml does not validate against tst3.dtd paphio:~/XML -> Unless you can produce a reproductable test case this bug is either invalid or already fixed... Daniel
This should be fixed in release libxml2-2.6.12. thanks, Daniel
Hi Daniel, Thanks. I don't have libxml2 2.6.12 installed, but I tested with libxml2 2.6.11 (latest Debian version), and it works as expected (line numbers show up). --Mike