473,836 Members | 1,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "applicatio n/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 3142
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 "applicatio n/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.....Lachl an, 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.....Lachl an, 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 incompatibiliti es 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....than ks 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....d efinitely
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....d efinitely
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....wh en 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
3733
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 bug? Can someone excellent to tell me the reason. best wishes
59
4792
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 XHTML1.0 Strict one, the media-handheld CSS is _ignored_. Only with the Nokia Doctype, the CSS is used. I find this really annoying as it goes against the whole idea of media-independent XHTML Strict along with stylesheets. On the good side, WML...
47
10321
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
4552
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 the content (MIME) type specified as text/html (http://keystonewebsites.com/articles/mime_type.php). These pages are then loaded on to their Server where they are served to Rendering Agents (browsers) as HTML (SGML application) documents with no...
8
2301
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 this foolishness about mime type="text/html" and then it tries to validate it using SGML (in liew of XHTML 2.0) rules. Obviously this all fails. Is there anything I can do? = = = = = = = Here's my doc: = = = = = = =
9
2350
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 "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> When I change the DOCTYPE to (what should be the equivalent):
22
2877
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 long as possible and since i'm not in a hurry at all, i wanted to use the most up-to-date authoring language. i use quite a lot html 4.01 in the past, then i recently read carefully the xhtml 1.0 specifications on the w3.org website --just few...
5
3351
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 standard XHTML doctype, do I need to add the extra html statement or is just plain ol' <html> enough? I'm not sure what the difference is or if it's required to use them together or not.
2
1498
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). What I would like to do is introduce an <entry> element to enclose a log entry. I would like to include, as possible children of <entry> certain elements of my own design and yet also allow arbitrary XHTML text to appear, perhaps in constrained...
0
9825
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9673
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10560
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9388
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5829
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.