473,385 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

xhtml, custom dtds, and MIME types

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

Jan 27 '06 #1
9 3112
wa*******@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
Jan 28 '06 #2
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
Jan 28 '06 #3
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

Jan 30 '06 #4
wa*******@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
Jan 31 '06 #5
Hi Lachlan....thanks again.

When I was talking about client side validation, I was talking about
Javascript and I was talking in the context of it using our custom
attributes when validating the content of a page on the client side -
totally distinct from any DTD.

In terms of the XHTML vs. HTML Strict, I was under the impression that
the benefit of XHTML was that it forces well formed documents (all
elements closed, lowercasing, etc...), whereas the HTML standard did
not. Perhaps I am mistaken in that....

I had never heard of using a vendor prefix on attributes....definitely
sounds like a solution for us. Presumably the validators (W3C, etc...)
ignore attributes that have a vendor prefix?

Thanks

Jan 31 '06 #6
wa*******@gmail.com wrote:
In terms of the XHTML vs. HTML Strict, I was under the impression that
the benefit of XHTML was that it forces well formed documents (all
elements closed, lowercasing, etc...), whereas the HTML standard did
not. Perhaps I am mistaken in that....
Yes, XHTML includes some additional requirements such as explicit end
tags (elements are always closed in HTML as well) but that means
nothing unless the pages are being fed to an XML parser. In text/html
web pages,
browsers will treat them just the same.
I had never heard of using a vendor prefix on attributes....definitely
sounds like a solution for us. Presumably the validators (W3C, etc...)
ignore attributes that have a vendor prefix?


No, they quite correctly flag it up as an error unless you use a custom
DTD. Lachlan explained why you should use vendor prefixes - to avoid
clashes in browsers with future official attributes.

Steve

Jan 31 '06 #7
Ok....thanks Steve....a few last questions - I was having a look at
some other sites on the Web that post the XHTML 1.0 compliant image and
ran them through the validator and they passed. What I did notice was
that some of these sites did not have a content type (i.e. MIME type)
declaration....what happens when this is omitted? Do the browsers
revert to their default behaviours of rendering as text/html?

In terms of the benefit of XHTML compliance, I believe the other
advantage is that it is where the technology is going and allows for
write-once run on multiple devices/platforms, so even though there is
no direct benefit at this time due to rendering as text/html, it may be
of benefit going forward - just trying to be proactive for changes and
minimize potential rework.

Thanks

Feb 1 '06 #8
wardy wrote:
Ok....thanks Steve....a few last questions - I was having a look at
some other sites on the Web that post the XHTML 1.0 compliant image and
ran them through the validator and they passed. What I did notice was
that some of these sites did not have a content type (i.e. MIME type)
declaration....what happens when this is omitted? Do the browsers
revert to their default behaviours of rendering as text/html?
Where were you looking for the content-type header? In the actual HTTP
headers or somewhere else (we're NOT talking about meta tags here). Can
you post the URL of a site that you doesn't think has a content-type
header?
In terms of the benefit of XHTML compliance, I believe the other
advantage is that it is where the technology is going and allows for
The technology doesn't know where its going. XHTML 1.1 is an exercise
in futility. XHTML 2.0 is deliberately broken as far as backwards
compatabilityis concerned. The current buzz is around HTML 5 but it may
just be buzz. With IE7 offering only minimal improvments over IE6 it
looks like the current state of play is going to last for several years
without any major changes.
write-once run on multiple devices/platforms,
Oddly enough that was the original reason for creating HTML in the
first place.

Whilst there are a few mobile platforms that only parse XHTML, most
will parse HTML and XHTML equally well/badly. With 99.999% of the web
made of bad HTML/bad XHTML pretending to be HTML there's no other
sensible option for device developers.
so even though there is
no direct benefit at this time due to rendering as text/html, it may be
of benefit going forward - just trying to be proactive for changes and
minimize potential rework.


Transforming valid HTML 4.01 Strict to valid XHTML 1.0 Strict is
trivial.

Steve

Feb 1 '06 #9
Hi Steve, again, thanks for all the help...this really is a minefield
of information and possibilities, especially when you're used to
dealing in black and whites...I think my statement in the last post
about omitting the content type was incorrect....when I went back and
viewed one of the sites (www.onesuffolk.co.uk) and checked the headers,
the content type was there and it was "text/html", so, for instance,
their site is XHTML Transitional but renders as "text/html". Is this
ok (which I guess the answer is subjective), as their site does
validate to the W3C using that setup? I guess for us, it's going to
come down to the fact that we will likely require a custom DTD for our
proprietary attributes we use, and so the only way we can have that
functionality and still validate would be to use the HTML DOCTYPE and
render as "text/html", thereby invoking the SGML parser for validation
which understands a customized HTML DTD. As I understand it, if I
tried XHTML DOCTYPE with a custom XHTML DTD but rendered to text/html,
this would still invoke the SGML parser, which can't understand an
XHTML custom DTD, so it would revert to the traditional DTD and cough
on our proprietary attributes. Correct me if I am wrong here
please....:)

JohnW

Feb 2 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: mike | last post by:
regards: I use Jtidy (api) to translate a HTML file into a "XHTML file". But The "XHTML file" cannot be identified by nokia 6600. Do I miss something important? Or this is Jtidy's weakness or...
59
by: Philipp Lenssen | last post by:
I've tested some of the new Nokia 6600 functionality. It ships with WAP2 and XHTML Support (it says). What it does is check the Doctype -- if it's not the XHTML Mobile Profile Doctype, but a...
47
by: Chuck | last post by:
Is there any logical reason why one should convert if css is already being used? What possible, immediate, benefit would there be? I am at a loss to see what, pragmatic, difference it would make.
32
by: jp29 | last post by:
My take on problems composing, serving and rendering XHTML documents/web pages: 1. Typical conscientious web authors are producing XHTML documents (Web pages) that feature valid Markup and with...
8
by: pacs34 | last post by:
I just read some stuff about XHTML 2.0 and it sounds fascinating so I have been trying to create a small test doc which has a few graphics files but whenever I submit it to the W3 validator I get...
9
by: rbronson1976 | last post by:
Hello all, I have a very strange situation -- I have a page that validates (using http://validator.w3.org/) as "XHTML 1.0 Strict" just fine. This page uses this DOCTYPE: <!DOCTYPE html PUBLIC...
22
by: Gianni Rondinini | last post by:
hi all. please excuse the misusage of some tech terms, but writing in english is not as easy as in italian :) i'm designing our new website and, since i want to do something that will last as...
5
by: Viken Karaguesian | last post by:
Hello everyone, I have a question about the XHTML doctype. I often times see this statement included in the <html> tag: <html xmlns="http://www.w3.org/1999/xhtml"> If I use the full...
2
by: Peter C. Chapin | last post by:
Hello! I'm in the process of creating a schema for marking up my personal astronomical observations (yes, I know this has already been done; I'm not worried about that... this is a pet project)....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.