|
|
|
|
Posted by wardy1975 on January 27, 2006, 2:34 pm
Please log in for more thread options
Hi All,
Looking for a little expert advice on a few web standards issues. I am
currently trying to understand the impact of web standards for a web
application I work with. I have been doing a lot of research in the
areas of XHTML and WAI compliance, and am attempting to come up with a
recommendation for our product in terms of standards level compliance.
Ideally, I would like to be at XHTML 1.0 Strict.
However, in my reading I have come across some discrepancies in my
attempt to understand these standards. In a perfect world, I would
render my content as "application/xhtml+xml" as is the recommendation
from the W3C, but unfortunately this is the real world, and the
application needs to be backward compatible and work in IE. I plan to
use content negotiation if possible, but may end up *sigh* always
rendering as "text/html" MIME type.
The problem I have is that our application uses and requires
proprietary attributes for html attributes, such as "required", which
the validator throws as an error. In doing some research, it appears
that I could customize the DTD to include these attributes, and then
some validators (apparently not the W3C one, which I have heard doesn't
understand customized DTD's).
And now the questions.....
1. Is it allowable to customize a DTD so that custom attributes do not
throw validation errors?
2. Does rendering a page with MIME type "text/html" still recognize
custom DTD declarations?
3. Is it allowable to not use a custom DTD, and on the web site state
that we are XHTML 1.0 Strict compliant, use the little W3C compliant
logo, and elaborate that the only non-valid sections are proprietary
tags?
4. If we do use a custom DTD, which the W3C validator doesn't
understand, can we still use their logo for compliance if we validate
on another validator (such as the WDG's)?
5. Do the validators provided in Firefox and the IE Dev toolbar beta,
for example, understand custom DTD's?
Sorry for the long post and all the questions, but this is such a grey
area and quickly gets confusing (especially when talking about backward
compatibility and MIME types) and I want to be sure that my
recommendations are in fact possible to accomplish.
Thanks in advance
|
|
Posted by Lachlan Hunt on January 28, 2006, 1:10 am
Please log in for more thread options
wardy1975@gmail.com wrote:
> However, in my reading I have come across some discrepancies in my
> attempt to understand these standards. In a perfect world, I would
> render my content as "application/xhtml+xml" as is the recommendation
> from the W3C, but unfortunately this is the real world, and the
> application needs to be backward compatible and work in IE. I plan to
> use content negotiation if possible, but may end up *sigh* always
> rendering as "text/html" MIME type.
Don't bother with content negotiation, just stick with HTML 4.01.
Sending application/xhtml+xml to Mozilla/Firefox currently prevents
incremental rendering of the page, which would be a fairly major problem
for a relatively large page downloaded over a dialup connection and
still a minor annoyance for those with faster connections.
> The problem I have is that our application uses and requires
> proprietary attributes for html attributes, such as "required", which
> the validator throws as an error.
Then, your application is broken. You could instead use
class="required" and then any client side scripts that currently make
use of the required attribute could just look for that instead.
> In doing some research, it appears that I could customize the DTD to
> include these attributes, and then some validators (apparently not the
> W3C one, which I have heard doesn't understand customized DTD's).
No, it understands them just fine, except that when you validate with a
custom XML DTD, you need to use a MIME type that will trigger XML
parsing mode, instead of SGML mode. It defaults to SGML mode for
unknown DTDs. Since you'll be serving it as text/html, you may as well
use a customised HTML 4 DTD.
> And now the questions.....
> 1. Is it allowable to customize a DTD so that custom attributes do not
> throw validation errors?
Yes.
> 2. Does rendering a page with MIME type "text/html" still recognize
> custom DTD declarations?
Yes, but the W3C validator will parse it with SGML mode instead of XML mode.
> 3. Is it allowable to not use a custom DTD, and on the web site state
> that we are XHTML 1.0 Strict compliant, use the little W3C compliant
> logo, and elaborate that the only non-valid sections are proprietary
> tags?
When it comes to those little icons, there's basically an honesty policy
in effect. Nothing will happen to you for using them on an invalid
page, except that the lie might confuse people (assuming they aren't web
developers) that click on it, wondering what on earth the little icon
means; in which case they'll be presented with an equally confusing
error message that they won't have a clue how to fix.
> 4. If we do use a custom DTD, which the W3C validator doesn't
> understand, can we still use their logo for compliance if we validate
> on another validator (such as the WDG's)?
Again, there's nothing stopping you from lying.
> 5. Do the validators provided in Firefox and the IE Dev toolbar beta,
> for example, understand custom DTD's?
What? I'm assuming you mean something like the web developer toolbars
for Firefox and IE, which simply make use of the W3C validator, or maybe
the HTML Tidy extension for firefox, which makes use of HTML Tidy. I'm
not sure whether HTML Tidy supports custom DTDs or not.
These artices should be useful for you.
http://www.cs.tut.fi/~jkorpela/html/own-dtd.html http://www.cs.tut.fi/~jkorpela/html/validation.html
In particular, take note of the section about the validation icons in
the validation article.
--
Lachlan Hunt
http://lachy.id.au/ http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
|
|
Posted by Nick Kew on January 28, 2006, 5:12 am
Please log in for more thread options
Lachlan Hunt wrote:
> No, it understands them just fine, except that when you validate with a
> custom XML DTD, you need to use a MIME type that will trigger XML
> parsing mode, instead of SGML mode. It defaults to SGML mode for
> unknown DTDs. Since you'll be serving it as text/html, you may as well
> use a customised HTML 4 DTD.
Indeed, sending custom-XHTML as text/html is just plain wrong.
>> 2. Does rendering a page with MIME type "text/html" still recognize
>> custom DTD declarations?
>
>
> Yes, but the W3C validator will parse it with SGML mode instead of XML
> mode.
As will other validators, including those that grok XML better than
the W3C ones (at least those I can speak for without faffing about
feeding them testcases).
> What? I'm assuming you mean something like the web developer toolbars
> for Firefox and IE, which simply make use of the W3C validator, or maybe
> the HTML Tidy extension for firefox, which makes use of HTML Tidy. I'm
> not sure whether HTML Tidy supports custom DTDs or not.
Tidy doesn't support DTDs. It's never claimed to be a validator
(although it is used *alongside* a true validator in some tools).
> In particular, take note of the section about the validation icons in
> the validation article.
Maybe. But the views of its author are not universal amongst informed
opinion.
--
Nick Kew
|
|
Posted by wardy1975 on January 30, 2006, 11:13 am
Please log in for more thread options
Thanks for the replies Lachlan and Nick....some very useful information
in there.....Lachlan, are you recommending not to go with an XHTML
DOCTYPE declaration at all, or just saying to always render as
"text/html" and forego content negotiation but still use the XHTML
DOCTYPE declaration?
Unfortunately, in terms of the custom attributes, we have approximately
a dozen or so, so using the "class" attribute as the catch all I don't
think will work - I think instead we would almost have to strip out all
of the invalid attributes prior to rendering to the browser, though
this will mean all client side validation is lost unless we use a
custom DTD.
If I understand what you have said though Lachlan about custom DTD's
and validating, I should be using a customized HTML DTD as the only way
I can validate with a customized XHTML DTD is to use a MIME type that
triggers an XML parser, and the text/html MIME type doesn't do this -
it invokes the SGML parser so it won't recognize the custom XHTML DTD.
So, my question would be, should I even be trying to XHTML compliance
at this point since I have to render to "text/html" anyway? I guess
the problem that I am going to have with this setup is that I want to
be able to validate with XHTML 1.0 Strict, but also have custom
attributes (which requires a custom DTD) but based on browser
restrictions I have to render as MIME type of "text/html", which means
I am never going to be able to reach my goal....is that an accurate
assessment from your comments?
Thanks again
|
|
Posted by Lachlan Hunt on January 30, 2006, 10:45 pm
Please log in for more thread options
wardy1975@gmail.com wrote:
> Thanks for the replies Lachlan and Nick....some very useful information
> in there.....Lachlan, are you recommending not to go with an XHTML
> DOCTYPE declaration at all, or just saying to always render as
> "text/html" and forego content negotiation but still use the XHTML
> DOCTYPE declaration?
I thought that was quite obvious from my statements, but think about it
this way:
1. Sending application/xhtml+xml to Mozilla prevents incremental rendering.
2. IE doesn't support application/xhtml+xml and requires text/html.
3. Sending XHTML as text/html is wrong, and is effectively the same as
sending incorrectly labelled HTML 4.
Therefore, do not send as application/xhtml+xml and do not use XHTML.
Use HTML 4.01 instead.
> Unfortunately, in terms of the custom attributes, we have approximately
> a dozen or so, so using the "class" attribute as the catch all I don't
> think will work
Firstly, be very careful using custom attributes. If you use, for
example, a foo attribute and in the not to distant future that foo
attribute is defined in a spec and implemented by browsers, your
interpretation of the attribute by your own script may be different from
that defined in a future spec, and thus may cause incompatibilities in
the future.
If you are absolutely positive that the class attribute isn't suitable
for your needs (remembering that it can contain multiple space-separated
values, it's not just limited to one) then use a vendor prefix, such as
the company's name or abbreviation, much like what is done with
proprietary/experimental CSS properties.
eg. instead of using
<p foo="bar">
use
<p x-foo="bar">
(where X is the name of the company)
If you were able to use real XHTML, you could instead define your own
namespace as in:
<html xmlns:x="http://www.example.org/x" xmlns="http://www.w3.org/1999/xhtml"> ...
<p x:foo="bar">
But, since you need to send it as HTML, that is not a real option.
Plus, DTDs don't really work well with namespaces anyway, you'd have to
go with RNG or Schema based validation.
> - I think instead we would almost have to strip out all
> of the invalid attributes prior to rendering to the browser, though
> this will mean all client side validation is lost unless we use a
> custom DTD.
Client side validation? Do you realise that browsers don't use
validating parsers and therefore they don't read the DTD? Or were you
talking about client side form validation, in which case, that has
nothing to do with a DTD.
> If I understand what you have said though Lachlan about custom DTD's
> and validating, I should be using a customized HTML DTD as the only way
> I can validate with a customized XHTML DTD is to use a MIME type that
> triggers an XML parser, and the text/html MIME type doesn't do this -
> it invokes the SGML parser so it won't recognize the custom XHTML DTD.
Yes.
> So, my question would be, should I even be trying to XHTML compliance
> at this point since I have to render to "text/html" anyway?
No.
> I guess the problem that I am going to have with this setup is that I want to
> be able to validate with XHTML 1.0 Strict,
Why? What does valid XHTML 1.0 Strict do that valid HTML 4.01 Strict
doesn't?
--
Lachlan Hunt
http://lachy.id.au/ http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
|
| Similar Threads | Posted | | mime types in Apache and the validator | June 6, 2008, 7:58 am |
| XHTML Mime Type support in MSIE 7.0 | October 2, 2005, 6:42 pm |
| MIME type for Windows 16-bit executable | January 13, 2007, 12:09 pm |
| trying to embed video by mime type | July 27, 2008, 8:46 am |
| Searching simple (!) web server which allows WAP/WML MIME pages | August 5, 2006, 1:45 pm |
| types of audio files for web page | April 28, 2005, 4:59 pm |
| how to display whatever the user types in a textarea | November 17, 2005, 1:24 pm |
| W3C discussion of link types and language | February 24, 2006, 11:26 am |
| Custom meta name="xxx" | October 31, 2007, 7:19 am |
| Indirection in the DTDs | October 5, 2004, 3:02 pm |
|
|
|
|