After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 131545 - xmllint: no line numbers in --dtdvalid validation output
xmllint: no line numbers in --dtdvalid validation output
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.4
Other Windows
: Normal enhancement
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2004-01-15 12:03 UTC by Michael Smith
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Smith 2004-01-15 12:03:41 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?
Comment 1 Daniel Veillard 2004-08-15 12:26:29 UTC
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
Comment 2 Daniel Veillard 2004-08-22 20:38:56 UTC
 This should be fixed in release libxml2-2.6.12.
                                                                                
   thanks,
                                                                                
Daniel
Comment 3 Michael Smith 2004-08-22 23:31:40 UTC
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