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 8697 - Validation of schema extensions in HTML documents
Summary: Validation of schema extensions in HTML documents
Status: RESOLVED WONTFIX
Alias: None
Product: HTML Checker
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: qa-dev tracking
URL: http://test.malden-dsme.co.uk/public/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-10 08:51 UTC by Dr. Martin W. Baker
Modified: 2015-08-27 05:56 UTC (History)
1 user (show)

See Also:


Attachments

Description Dr. Martin W. Baker 2010-01-10 08:51:36 UTC
Validating document http://test.malden-dsme.co.uk/public/homepage/index.asp reports two errors - one regarding an <hr /> - this is valid and please ignore.

The second error relates to an attribute declared in a custom namespace.  It seems that the validator completely ignores the xmlns:ydr declaration in the <html> tag - for if you put an invalid url there you get no validation error.

As a result of ignoring the xmlns:ydr validation it then goes on to complain that an attribute created under that schema is invalid.

(The xsd validates OK with your XSD validator.)

(It may well be that I have errors in the way I am using the xsd - I can resolve this once the validator is recognising the namespace).

I can confirm that the use of the namespace works absolutely fine with Internet Explorer, Chrome and Firefox, and with each of these browsers an error is reported (correctly) if the namespace declaration is missing from <html>
Comment 1 Michael[tm] Smith 2010-06-14 09:01:30 UTC
(In reply to comment #0)
> The second error relates to an attribute declared in a custom namespace.  It
> seems that the validator completely ignores the xmlns:ydr declaration in the
> <html> tag - for if you put an invalid url there you get no validation error.

You're serving that document with an text/html content type (not an XML content type), so the validator is processing it using HTML parsing rules, not XML parsing rules. And in HTML parsing, there is no support for declaring arbitrary namespaces, and it just considers "xmlns:ydr" to be a literal attribute name.

> As a result of ignoring the xmlns:ydr validation it then goes on to complain
> that an attribute created under that schema is invalid.

It is invalid as far as the HTML language is concerned -- regardless of whether you serve the document as text/html or with an XML content type. Attributes from custom namespaces are not allowed in conforming HTML/XHTML documents; only the canonical attributes that are actually part of the language are valid.

It's fine to use an attribute from a custom namespace if you serve the document with an XML content type (not as text/html) and if you recognize that if you do so, the validator is always going to flag it as a validity error when you check the document against a canonical HTML/XHTML schema.
Comment 2 Dr. Martin W. Baker 2015-08-25 15:49:03 UTC
The X of XHTML surely means extensible.

The standard means of making xml formatted documents extensible is to add a namespace.

W3C introduced a namespace for xhtml  namely http://www.w3.org/1999/xhtml and this was included once upon a time in the <html> tag.

If we were checking solely as HTML your comment would be valid.  It seems inappropriate if checking against XHTML.
Comment 3 Michael[tm] Smith 2015-08-26 08:44:01 UTC
(In reply to Dr. Martin W. Baker from comment #2)
> The X of XHTML surely means extensible.
> 
> The standard means of making xml formatted documents extensible is to add a
> namespace.
> 
> W3C introduced a namespace for xhtml  namely http://www.w3.org/1999/xhtml
> and this was included once upon a time in the <html> tag.
> 
> If we were checking solely as HTML your comment would be valid.  It seems
> inappropriate if checking against XHTML.

Per the HTML spec, arbitrary elements from arbitrary namespaces are not valid in an HTML document regardless if you conceptually think of that document as an "XHTML" document.

You're free to create documents that extend the HTML language with an kind f arbitrary elements and attributes you want, but if you do, one consequence is that per the HTML spec, they will no longer be HTML documents that conform to the HTML spec, and the checker will point that out.

You can use the "Message Filtering" feature in the checker to persistently filter out any checker messages you don't want to see.

But as I alluded to in my earlier comment, if you're serving your documents with a text/html media type (rather than an XML media type) then you are asking for them to actually be parsed as text/html and not with an XML parser.

And in that case your elements do not actually end up in the DOM in other namespaces. Instead they end up in the DOM as elements with only a local name that has prefix and colon in it.

So if you want to actually put the elements into a namespace, the documents should be served with an XML media type, not a text/html media type.
Comment 4 Dr. Martin W. Baker 2015-08-27 05:56:01 UTC
I actually send the documents rendered in a browser with my own extensions for my own code to use.  

Has been working the odd decade or so and previouly had not been flagged by other validators.

We are in the somewhat weird situation that all the browsers I have tried this on work fine with it.

Your validator encourages the removal of the namespace declaration

If I do as the validator suggests then the browsers object to the document and won't process it right.

Some harmony between general practice and the validator should exist.  

Can you tell me where in the standards it now deprecates the use of namespaces in HTML documents (maybe a deprecation note that I have failed to see in the last couple of decades.  

If it has been deprecated then that would explain why browsers are tolerant and you are not.

regards