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 427616 - 'xmllint --loaddtd --valid' doesn't detect an invalid XML file
'xmllint --loaddtd --valid' doesn't detect an invalid XML file
Status: RESOLVED NOTABUG
Product: libxml2
Classification: Platform
Component: general
2.6.27
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2007-04-08 16:50 UTC by Mike Hommey
Modified: 2008-12-27 23:02 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mike Hommey 2007-04-08 16:50:47 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.)
Comment 1 Daniel Veillard 2007-06-13 15:48:35 UTC
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
Comment 2 Vincent Lefevre 2008-12-27 23:02:10 UTC
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.