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 679539 - Fails to validate documents with a DOCTYPE but without a DTD
Fails to validate documents with a DOCTYPE but without a DTD
Status: RESOLVED NOTABUG
Product: libxml2
Classification: Platform
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2012-07-07 05:58 UTC by Leif Halvard Silli
Modified: 2017-06-14 00:33 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Leif Halvard Silli 2012-07-07 05:58:26 UTC
XML 1.0 points out that: 

"Note that it is possible to construct a well-formed document containing a doctypedecl that neither points to an external subset nor contains an internal subset."

http://www.w3.org/TR/REC-xml/#sec-prolog-dtd

Thus, when running 

    xmllint --validate  http://example.com/XHTML-5-document.xhtml

then xmlint should whine if the DOCTYPE says:

   <!DOCTYPE HTML>
or 
   <!DOCTYPE hTmL>

See: http://www.w3.org/TR/REC-xml/#vc-roottype

However, xmllint fails to report validity errors with the DOCTYPE. Instead, it reports errors that the document is lacking a DTD.

Please make sure that

   xmllint --validate

will also check that root "fragmetn" of the DOCTYPE uses the correct casing and/or that it matches the root elemetn. (If the namespace is known, as it is for XHML, then xmllint would know that root element should be in lowercase. Thus, in that case it might make sense say that it is the DOCTYPE that is in error.  In other cases, if there is no namespace, then it might be better to say that it is the root element that is in error.
Comment 1 Nick Wellnhofer 2017-06-14 00:33:46 UTC
Yes, libxml2 could verify the name of the root element even if there's no DTD, but I don't understand how this would be useful. The spec defines validity as:

"Definition: An XML document is *valid* if it has an associated document type declaration and if the document complies with the constraints expressed in it."

Documents without an associated DTD aren't valid by definition.