This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 4476 - Auto-Detect fallback document type based on root element
Summary: Auto-Detect fallback document type based on root element
Status: NEW
Alias: None
Product: Validator
Classification: Unclassified
Component: check (show other bugs)
Version: 0.8.0b1
Hardware: All All
: P2 normal
Target Milestone: 1.0
Assignee: Olivier Thereaux
QA Contact: qa-dev tracking
Depends on:
Reported: 2007-04-19 14:29 UTC by Chris Lilley
Modified: 2017-04-13 21:54 UTC (History)
2 users (show)

See Also:


Description Chris Lilley 2007-04-19 14:29:04 UTC
I'm puzzled that, when checking the (correct) document

<svg xmlns=""/>

the beta validator tells me that 

a) its invalid (its not); 
b) that I should add an HTML 4 transitional doctype and that until I do, my document will be invalid (not true) and 
c) that there is an xml namespace declaration in a non-xml document (it is an xml document)
Comment 1 Olivier Thereaux 2007-04-19 22:30:41 UTC
If your document does not declare its document type, just use the "Use Doctype" option and it will validate just fine. 

Otherwise, especially in the case of direct input, the validator does not know 1) the document type 2) the media type (hence falling back to sgml mode because it does not know the document type either)
Comment 2 Olivier Thereaux 2007-04-19 22:44:27 UTC
Changing Summary From:
well formedness, validity, xmlns and 'not HTML'
Auto-Detect fallback document type based on root element

and setting to a someday milestone, as this may not be trivial enough for immediate fix.
Comment 3 Chris Lilley 2007-04-20 15:27:19 UTC
Thanks for the summary change, Olivier. It covers most of my point and is clearer.

The remaining thing is that the validator says that a document is not valid. Rather, it should say that it does not know if its valid. Reviewing the possible sources of machine-readable validity information:

a) A DTD may be supplied, and may or may not be intended to completely describe a document (it may for example just declare some entities in the internal DTD subset)
b) A W3C XML Schema may be supplied (but providing a link to one with xsi:schemaLocation is optional)
c) A RelaxNG schema, with or without Schematron annotation may be there. General practice is not to explicitly link to it from the instance.

Thus, when presented with a document, the validator should exercise caution when declaring that something is invalid. Sometimes it is invalid, sometimes its valid ,and sometimes the validator does not have enough information to tell (or does not support the schema language used). I would like the validator to explicitly use this third case where appropriate, rather than giving a false negative.
Comment 4 Chris Lilley 2007-04-20 15:28:30 UTC
Also, what causes the "there is an xml namespace declaration in a non-xml document"?

I tried adding the (optional) xml declaration, but got the same error.
Comment 5 Terje Bless 2007-04-20 16:15:49 UTC
Fo lack of information the Validator is using its default mode  which is SGML  and then warning you that you're using an XML feature in a non-XML document instance. IOW, it's kind of a cascading error.
Comment 6 Olivier Thereaux 2007-05-07 14:46:59 UTC
Let's see if this can be dealt with for 0.8.0...
Comment 7 Olivier Thereaux 2007-05-07 19:27:19 UTC
Some recent improvements to the handling of XML documents have made this case less acute:


The example:;ss
* is served with an XML mime type
* does not have an <html> root element
=> and is therefore marked as being well-formed XML

The idea of falling back to an SVG doctype based on svg root element still stands.

Note that in the case of direct input, sending something like:
<svg xmlns=""/>
 the validator will remain confused, for lack of a good way (i.e mediat type) to know if the document is XML.

Comment 8 Olivier Thereaux 2007-05-23 05:32:59 UTC
I looked at this in the past few days, and the way to make this work would probably be too disruptive to be done safely at such a stage (beta test), so I would rather play safe and do it later.

Moving target milestone.
Comment 9 Ruud Steltenpool 2008-06-24 10:15:51 UTC
For a future "can't tell" validation result i propose a favicon that has:
- the top left half red
- the bottom right half green
- a black question mark on top

Same for the colored bar in the result page