By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 1,938 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

Stricter 4.01 Strict DTD

P: n/a
I've been thinking about using a custom "stricter" local HTML 4.01
Strict DTD for the purpose of local validation. That way I wouldn't have
to change my doctype, my documents would still adhere to the public 4.01
Strict DTD, but I'd have the added advantage that I get warnings for
example for unclosed paragraph tags when validating locally by mapping
my local validator (ARV) to that local custom DTD.

Any disadvantages in doing that, and has anyone created such a
"stricter" 4.01 Strict DTD?

--
Spartanicus
Jul 20 '05 #1
Share this Question
Share on Google+
13 Replies


P: n/a
Spartanicus <me@privacy.net> wrote:
I've been thinking about using a custom "stricter" local HTML 4.01
Strict DTD for the purpose of local validation.
Actually that's what I did yesterday. I copied the Strict DTD, removed
the comments, producing http://www.cs.tut.fi/~jkorpela/html/401.dtd
and then souped up some changes:
http://www.cs.tut.fi/~jkorpela/html/my401.dtd

Well, I didn't _only_ make it stricter but also added some tags that
are needed for decent line breaking control in some cases, since
browsers have _so_ clueless line breaking these days - they partly
support the worse than useless part of Unicode line breaking rules but
don't even support the control characters defined for overriding them.
Here's a brief documentation of what I did:

* NOBR and WBR added as text level markup.
* Define %Pixels; as NUMBER, not CDATA.
* Make start tags required for all elements.
* But allow TR directly inside TABLE, as in XHTML.
* Make end tags required for all non-EMPTY elements.
* Make LANG required for HTML.

(Thus, the fairly common argument in favor of XHTML that it is needed
for making end tags compulsory simply isn't true.)

(If anyone wants to use those files, please copy them instead of
referring to them via URLs.)
Any disadvantages in doing that,


Browsers may punish you for not participating in the cargo cult, i.e.
they may switch to "quirks mode" (that is, intentionally erroneous
mode) if you don't have the Strict DTD in the spelling they want.
You might ignore this if you don't use any features in HTML or (more
probably) in CSS that get hurt in "quirks mode". Or you might cheat
those who cheat: you could use your own DTD in validation (locally or
using the validators on the Web) and the sacred spelli in the documents
that you actually put onto the Web.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #2

P: n/a
In article <g0********************************@news.spartanic us.utvinternet.ie>,
Spartanicus <me@privacy.net> writes:
I've been thinking about using a custom "stricter" local HTML 4.01
Strict DTD for the purpose of local validation. That way I wouldn't have
to change my doctype, my documents would still adhere to the public 4.01
Strict DTD, but I'd have the added advantage that I get warnings for
example for unclosed paragraph tags when validating locally by mapping
my local validator (ARV) to that local custom DTD.


Yes, people sometimes do that.

But there's a better way to accomplish your goal (assuming your validator
is based on OpenSP - as all the known HTML validators are). You can
set options with the OpenSP parser to issue warnings for things like
unclosed tags at runtime, without touching the DTD at all.
That's exactly what the "fussy" mode of Page Valet does -
see http://valet.webthing.com/page/parsemode.html

--
Nick Kew
Jul 20 '05 #3

P: n/a
ni**@hugin.webthing.com (Nick Kew) wrote:
But there's a better way to accomplish your goal (assuming your validator
is based on OpenSP - as all the known HTML validators are). You can
set options with the OpenSP parser to issue warnings for things like
unclosed tags at runtime, without touching the DTD at all.


I don't think that's possible with ARV, it's configuration file maps
doctype's to local DTD's, nothing more.

--
Spartanicus
Jul 20 '05 #4

P: n/a
"Jukka K. Korpela" <jk******@cs.tut.fi> wrote:
http://www.cs.tut.fi/~jkorpela/html/my401.dtd


From your my401.dtd:
<!ELEMENT COL - - EMPTY>

Shouldn't that read:
<!ELEMENT COL - O EMPTY>

since it's empty?
Any disadvantages in doing that,


Browsers may punish you for not participating in the cargo cult, i.e.
they may switch to "quirks mode" (that is, intentionally erroneous
mode) if you don't have the Strict DTD in the spelling they want.
You might ignore this if you don't use any features in HTML or (more
probably) in CSS that get hurt in "quirks mode". Or you might cheat
those who cheat: you could use your own DTD in validation (locally or
using the validators on the Web) and the sacred spelli in the documents
that you actually put onto the Web.


No need, I use ARV as an offline batch validator, it works by mapping
doctypes to a local version of the DTD, all I have to do is point it to
the stricter local DTD.

I've managed to make most of the changes I wanted to the "stricter"
local DTD via trial and error, I haven't managed to figure out how to
make lower case tags and quoted attribute values mandatory, anyone know
how to do that?

--
Spartanicus
Jul 20 '05 #5

P: n/a
It seems "Jukka K. Korpela" wrote in
comp.infosystems.www.authoring.html:
* But allow TR directly inside TABLE, as in XHTML.


Is that a typo? I thought <table><tr> _was_ legal in HTML 4.01
strict.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #6

P: n/a
On Mon, 2 Feb 2004 11:06:09 -0500, Stan Brown <th************@fastmail.fm>
wrote:
It seems "Jukka K. Korpela" wrote in
comp.infosystems.www.authoring.html:
* But allow TR directly inside TABLE, as in XHTML.


Is that a typo? I thought <table><tr> _was_ legal in HTML 4.01
strict.


It is shorthand for

<table><tbody><tr>

in HTML 4. Both start and end tags of TBODY are optional, but there is
always at elast one TBDOY element in a TABLE element.

<!ELEMENT TABLE - -
(CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>
XHTML doesn't allow such minimization, but also didn't want to force
ayhors to include two extra tags in each and every table... See
http://www.w3.org/TR/html/#C_11

--
Rijk van Geijtenbeek

The Web is a procrastination apparatus:
It can absorb as much time as is required to ensure that you
won't get any real work done. - J.Nielsen
Jul 20 '05 #7

P: n/a
Spartanicus <me@privacy.net> wrote:
From your my401.dtd:
<!ELEMENT COL - - EMPTY>

Shouldn't that read:
<!ELEMENT COL - O EMPTY>

since it's empty?


Right, of course, thanks. Something went wrong in the global replace.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #8

P: n/a
"Jukka K. Korpela" <jk******@cs.tut.fi> writes:
you could use your own DTD in validation (locally or
using the validators on the Web) and the sacred spelli in the documents
that you actually put onto the Web.


For local validation with open SP you can just put e.g. the html 4.01
strict doctype declaration in the document for the sniffing voodoo and
initialise nsgmls with a catalogue file that contains nothing but

DOCTYPE HTML path/to/my.dtd

No need to fumble with the document instance itself.
I have, BTW, recently taken the opposite approach:
<http://sandbox.bednarz.nl/sgml/dtd/tagsoup.dtd>
(SCNR :)
--
| ) 111010111011 | http://bednarz.nl/
-(
| ) Distribute me: http://binaries.bednarz.nl/mp3/aisha
Jul 20 '05 #9

P: n/a
It seems "Rijk van Geijtenbeek" wrote in
comp.infosystems.www.authoring.html:
On Mon, 2 Feb 2004 11:06:09 -0500, Stan Brown <th************@fastmail.fm>
wrote:
I thought <table><tr> _was_ legal in HTML 4.01 strict.


It is shorthand for
<table><tbody><tr>


Thanks, Rijk! I forgot that a <tr> is inside <tbody> even if I leave
out the <tbody> tag.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #10

P: n/a
Spartanicus <me@privacy.net> wrote in message news:
I've managed to make most of the changes I wanted to the "stricter"
local DTD via trial and error, I haven't managed to figure out how to
make lower case tags and quoted attribute values mandatory, anyone know
how to do that?


Your search for previous discussions on the exact same topic
apparently missed this:

http://groups.google.com/groups?hl=e...lid%26rnum%3D1
Jul 20 '05 #11

P: n/a
Eric B. Bednarz <be*****@fahr-zur-hoelle.org> wrote:
I have, BTW, recently taken the opposite approach:
<http://sandbox.bednarz.nl/sgml/dtd/tagsoup.dtd>


Seems I'm not the only one unimpressed by the current fad of marking
up almost anything as a list:

http://sandbox.bednarz.nl/sgml/html/...obfuscate.html
Jul 20 '05 #12

P: n/a
Jukka K. Korpela <jk******@cs.tut.fi> wrote:
Actually that's what I did yesterday. I copied the Strict DTD, removed
the comments, producing http://www.cs.tut.fi/~jkorpela/html/401.dtd
and then souped up some changes:
http://www.cs.tut.fi/~jkorpela/html/my401.dtd


How would I make a page with this DTD? What's the doctype?
--
Michael Wilcox
mjwilco at yahoo dot com
Essential Tools for the Web Developer - http://mikewilcox.t35.com
Jul 20 '05 #13

P: n/a
Michael Wilcox <mj*****************@yahoo.com> wrote:
How would I make a page with this DTD? What's the doctype?


Ah, I answered my own question. Seems the following line does it:
<!DOCTYPE HTML SYSTEM "http://www.example.com/my401.dtd">

--
Michael Wilcox
mjwilco at yahoo dot com
Essential Tools for the Web Developer - http://mikewilcox.t35.com
Jul 20 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.