GNOME Bugzilla – Bug 427616
'xmllint --loaddtd --valid' doesn't detect an invalid XML file
Last modified: 2008-12-27 23:02:10 UTC
(I thought this was already reported here, but seems like I was incorrect... I let rot this bug for too long in debian's bts) Consider the following files: -- tst.xml ------------------------------------------------------- <?xml version="1.0"?> <!DOCTYPE root SYSTEM "tst.dtd"> <root/> ------------------------------------------------------------------ -- tst.dtd ------------------------------------------------------- <!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "xhtml-lat1.ent"> %HTMLlat1; <!ENTITY % URI "CDATA"> <!ELEMENT root (#PCDATA)> <!ATTLIST root xmlns %URI; #IMPLIED > ------------------------------------------------------------------ and the standard xhtml-lat1.ent is in the current directory. 'xmllint --loaddtd --valid tst.xml' doesn't report any error, though the XML file is invalid (a standalone="yes" is missing). See https://sourceforge.net/tracker/index.php?func=detail&aid=707469&group_id=10127&atid=110127 (The bug reporter first thought that there was a bug in Sablotron, which reported an error, but according to this discussion, this is due to the fact that the XML file is invalid.)
First --valid means the parser *will* load the DTD, so "--loaddtd --valid " is superfluous. Most people don't understand the standalone "attribute" Lack of standalone cannot make a file invalid. Only the *presence* of 'standalone="yes"' can generate a validity error if some of the content of the document comes from defaulted value inherited from processing the DTD. Your document has no standalone declaration as far as I can tell. So "If there are external markup declarations but there is no standalone document declaration, the value "no" is assumed." The pointer to sourceforce makes no sensible explanation to why you could think there is a validity error. Please give me a pointer to the actual VC validity constraint you think is hit there from the spec http://www.w3.org/TR/REC-xml/ I suggest to reread section 2.9, I really think I understand that part, but I may be wrong ! I have left a bug since 2.5.0 in the validity checking for standalone declaration, in part because I'm lazy, and also to assert whether anybody would ever point this out. 2.5 years later nobody did ! I think only a handful of people actually understand it, and even less people use it correctly. So either your test case is wrong, or you forgot something, or the bug is wrong, or I am the one not understanding that spec ;-) Daniel
I'm at the origin of this bug report. I've just looked at the problem more closely, and in fact, the cause of the problem is that Sablotron (more precisely the XML parser it uses) doesn't parse public parameter entities by default (and outputs an obscure error message), hence surprising differences between XSLT processors (this has also been mentioned here: <http://sources.redhat.com/ml/xsl-list/2000-07/msg01105.html>). So, no bugs at all.