473,573 Members | 2,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

W3C Validator error? <br /> is valid for doctype HTML 4.01 Strict

Hi everyone,

Is the W3C HTML Validator [1] in error when it returns <br /> as valid
for HTML 4.01 Strict doctype?

In March 2004 [2], the Validator returned <br />, <hr /> and <img />
as invalid for HTML 4.01 Strict.

Liam Quinn said [2] "You can't mix HTML and XHTML. You need to choose
one or the other syntax."
[meaning: choose <br> for HTML and <br /> for XHTML]

As for today, the Validator returns <br /> and <img /> as valid for
HTML 4.01 Strict, but <hr /> (and also <meta /> and <link />)
as invalid.

It seems that the Validator has changed its behaviour since 2004.

[1] http://validator.w3.org/
[2] http://lists.w3.org/Archives/Public/...r/2003Mar/0028
Liam Quinn is a founding member of WDG (Wed Desing Group).

Thanks,
Thomas Jedenfelt
Tyresö (Stockholm), Sweden

Jul 24 '05 #1
12 45293
th************* ***@operamail.c om wrote:
Is the W3C HTML Validator [1] in error when it returns <br /> as
valid for HTML 4.01 Strict doctype?
No, because <br /> is valid (and equivalent to <br >>).
In March 2004 [2], the Validator returned <br />, <hr /> and <img
/> as invalid for HTML 4.01 Strict.
No, you misunderstood - which is understandable, since the statement
was not very clearly formulated.

The reason why <br /> is valid is that wherever <br> is allowed, it may
be followed by character data, so <br>> is valid too. But <hr /> is
often not allowed in HTML 4.01 Strict. If you have
<body>
<hr>>
</body>
then <hr> is OK (hr is a block level element) but > is not.

For a detailed explanation, see
http://www.cs.tut.fi/~jkorpela/html/empty.html
It seems that the Validator has changed its behaviour since 2004.


Not in this respect; the report about its behaviour was just vague.

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

Jul 24 '05 #2
th************* ***@operamail.c om wrote:
Is the W3C HTML Validator [1] in error when it returns <br /> as valid
for HTML 4.01 Strict doctype?
No. It's valid. In HTML <br/> is short for <br>> (whereas in XHTML it
is short for <br></br>). Fortunately (from the point of view of XHTML
bacwards compatability) virtually no browser gets HTML right so it's
treated as <br>.
In March 2004 [2], the Validator returned <br />, <hr /> and <img />
as invalid for HTML 4.01 Strict.
Depends where you use them. As they are equivalent to <br>>, <hr>> and
<img>> you can not use them where text (i.e. the >) would be invalid
(though that would also rule out <img>).
Liam Quinn said [2] "You can't mix HTML and XHTML. You need to choose
one or the other syntax."
[meaning: choose <br> for HTML and <br /> for XHTML]
Good, and correct, advice.
As for today, the Validator returns <br /> and <img /> as valid for
HTML 4.01 Strict, but <hr /> (and also <meta /> and <link />)
as invalid.
Presumably you're using <br /> an <img /> in places where text is
allowed and hence the > is valid. But the <hr/> is in a place where
text is not allowed and hence then > is an error. As <meta> and <link>
can only go in the head, where text is not allowed you must use the
HTML form.
It seems that the Validator has changed its behaviour since 2004.


Have you asked the W3C Validator team?

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net > <http://steve.pugh.net/>
Jul 24 '05 #3
th************* ***@operamail.c om wrote:
In March 2004 [2], the Validator returned <br />, <hr /> and <img />
as invalid for HTML 4.01 Strict.

Liam Quinn said [2] "You can't mix HTML and XHTML. You need to choose
one or the other syntax."
[meaning: choose <br> for HTML and <br /> for XHTML]

As for today, the Validator returns <br /> and <img /> as valid for
HTML 4.01 Strict, but <hr /> (and also <meta /> and <link />)
as invalid.

It seems that the Validator has changed its behaviour since 2004.


In HTML 4.01, <br /> is equivalent to <br>>. It's not invalid, just
different from what you mean. <meta /> and <link /> are invalid because
the second greater-than sign ends the HEAD section (any character data
would), and you presumably haven't completed it yet. <hr /> is invalid
because while block-level content (the HR element itself) is allowed as
a direct child of the BODY element in Strict, character data (the
greater-than sign) isn't.

I'm not sure why the results were different when you previously tried.
Are you sure it was the same document?
Jul 24 '05 #4
th************* ***@operamail.c om wrote:

Liam Quinn said [2] "You can't mix HTML and XHTML. You need to choose
one or the other syntax."
Yep.
[meaning: choose <br> for HTML and <br /> for XHTML]
Yep. But that's not what it looks like.
As for today, the Validator returns <br /> and <img /> as valid for
HTML 4.01 Strict, but <hr /> (and also <meta /> and <link />)
as invalid.


Nope. It depends entirely on context whether any of those are
technically valid. But if they are, they are valid for the wrong
reason (some of us call it a bug in the HTML spec) and don't
mean what you think.

See http://valet.webthing.com/page/parsemode.html

--
Nick Kew
Jul 24 '05 #5
Hello Yucca,

Thanks for replying.

The discussion seems to concern two issues:

1. Changed behaviour of W3C Validator
2. <br /> conforming to HTML 4.01 Specification

1.
I don't agree with you that I have misunderstood the thread at
ww***********@w 3.org [1].

Because, the teacher that checked (in March 2004) his HTML 4.01 Strict
document got <br /> and <img /> as invalid by the Validator.

So, that would mean that the Validator has changed its behaviour since
March 2004, as it nowadays returns <br /> as valid for an HTML 4.01
Strict document.

Now, although I have written W3C/WAI valid docuemnts
(non-professionally) since 1999(?) - and read the W3C technical reports
- I have failed to notice (in the 4.01 Spec.) that <br /> is valid HTML
4.01 Strict, because during the years from XHTML Spec. <br /> was not
valid 4.01, if I remember correctly. Therefore, I have, until now,
regarded <br /> as unique for XHTML documents.

So, it seems that they have updated the Validator, as they do from time
to time.
2.
I am too tired to continue. I will finnish tomorrow.

Thanks also to Steve and Leif for replying. (I just saw your messages.)

Regards,
Thomas Jedenfelt

[1]
http://lists.w3.org/Archives/Public/...r/2003Mar/0028

Jul 24 '05 #6
Thomas Jedenfelt wrote:
1. Changed behaviour of W3C Validator
2. <br /> conforming to HTML 4.01 Specification

Because, the teacher that checked (in March 2004) his HTML 4.01 Strict
I think you mean 2003.
document got <br /> and <img /> as invalid by the Validator. So, that would mean that the Validator has changed its behaviour since
March 2004, as it nowadays returns <br /> as valid for an HTML 4.01
Strict document.
Since they didn't provide an example document demonstrating the issue, it is
difficult to try to reproduce it. I suppose the public CVS archives might
go back far enough that its possible to retrieve it, but that's rather too
much effort for me to worry about right now.

Either:

1. There was a bug in the validator in early 2003 that has now been fixed

or

2. The author of that email was finding that <hr /> was invalid and
*assuming* that <img /> and <br /> were too.

I'd suspect option 2 myself.
Now, although I have written W3C/WAI valid docuemnts
(non-professionally) since 1999(?) - and read the W3C technical reports
- I have failed to notice (in the 4.01 Spec.) that <br /> is valid HTML
4.01 Strict


The spec doesn't say that it is valid, nor does it say that its invalid. Its
obscure stuff that you generally don't find out unless you read the SGML
spec or someone else explains it to you.
--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 24 '05 #7
David Dorward wrote:
2. The author of that email was finding that <hr /> was invalid and
*assuming* that <img /> and <br /> were too.

I'd suspect option 2 myself.


I wouldn't.

I expect the reason for the difference was context.
Technically speaking, <hr/> & friends are valid where
bare text is allowed. Your example now had them inside
a <p> or <div> or somesuch, whereas in the 2003 example
they were not in a valid context.

--
Nick Kew
Jul 24 '05 #8
On Thu, 21 Apr 2005 20:54:18 +0100, Nick Kew <ni**@asgard.we bthing.com>
wrote:
th************ ****@operamail. com wrote:
Liam Quinn said [2] "You can't mix HTML and XHTML. You need to choose
one or the other syntax." Yep.
That part holds true so far...
[meaning: choose <br> for HTML and <br /> for XHTML]
It seems to me that most people that gets into to this kind of
discussion does not have a first clue of what's at stake.
Yep. But that's not what it looks like.
As it has been repeated in this NG for years now...
As for today, the Validator returns <br /> and <img /> as valid for
HTML 4.01 Strict, but <hr /> (and also <meta /> and <link />)
as invalid.


Why do you think that there has to be a whitespace before NESTC+NET?

Has it ever occured to you that it may be an afterconstruct, designed to
use available browsers bugs to get through?
Nope. It depends entirely on context whether any of those are
technically valid...


--
Rex

Jul 24 '05 #9
Hello all,

Thanks for the input.

Let's see if I can summarize:

1. THE VALIDATOR's BEHAVIOUR
2. <br /> CONFORMING TO 4.01 SPEC.
3. HOW TO CHOOSE CODE
1. THE VALIDATOR's BEHAVIOUR

We don't know how teacher's document was coded, or the behaviour of the
Validator in March 2004.

So, that the teacher found his document invalid, may be due to wrong
coding and/or that the Validator may have wrongly interpreted the 4.01
Spec.

Let us just leave the discussion for this topic, as we cannot capture
what has gone before.

Currently (April 2005), the Validator validates <br /> and <img />, but
not <hr />, as HTML 4.01 Strict.

News for the W3C Markup Validator
http://validator.w3.org/whatsnew.html
2. <br /> CONFORMING TO 4.01 SPEC.

May be valid HTML 4.01
<br />, <br>>, <img />
An element (not the tags <>) may be followed by
character data (<br z>).

May not be valid HTML 4.01
<hr />, <hr>>, <meta />, <link />

HTML 4.01 Spec. and SGML Spec. may be interpreted differently by people
(Spec. authors, Web page authors, the Validator Team), and HTML 4.01
Spec. also has errors.
http://www.w3.org/MarkUp/html4-updates/errata

HTML 4.01 Spec.: On SGML and HTML
http://www.w3.org/TR/html401/intro/sgmltut.html

SGML Source Home Page (by the SGML inventor himself)
http://www.sgmlsource.com/
3. HOW TO CHOOSE CODE

Following Liam Quinn's advice, I will use <> for HTML 4.01 Strict and
</> for XHTML, as I have done before.
Finally.
It would be nice if you could post links to W3C documents regarding the
above. And, links to people who has written comments on this topic.

(Thanks to Yucca for his link.)

Regards,
Thomas Jedenfelt

Jul 24 '05 #10

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

Similar topics

9
5872
by: loveNUNO | last post by:
I'am using xt to convert my xml with an xsl to html. When i use <br /> in my xsl document in turns into <br> in the html. So, How am I get <br/> TAG in output(html) like xhtml?
4
7849
by: fis | last post by:
Hi all, I've problem because there are needed break lines in my texts on the web site but i can't do it :( My pipeline looks like: XMS -> I18N -> XSLT -> HTML I have lot of texts in my "languages" files and these are describes for things on my website. Example text looks like this:
6
12144
by: Lasse | last post by:
I have done this simple function, it seems to work as intended, to solve a problem i have had for a while. I couldnt find any sample around that was working for me. I would like to test it with you and see if there are any improvments that i should make ;-) It should be fast and if possible compatible with todays modern browser-standards. It...
9
9215
by: red | last post by:
If I have <span>text</span> <br> and then some text isn't there sopposed to be a line break between the span and the text ? Why do browsers ignore the <br> ?
7
19107
by: noor.rahman | last post by:
I have an XML file that stores data from an HTML form. I use XSL to display the data in HTML format. The data may have newline characters. However, XSL is not displaying the newlines properly in the browser. I even replaced all the newlines with <BR/> tags but eventhough I see the tags in my source, I don't get a line break in the output...
15
2715
by: tshad | last post by:
How do I go about this? I used to know this, but can't find VB.net replace that does this. Something like string.replace("<br>",NL) Thanks,
2
6586
by: PapaRandy | last post by:
Hello, I am trying to validate the following .py webpage as HTML (through W3C). I put: ----------------------------------------------------------------------------- print "Content-type: text/html; charset=utf-8"
23
2219
by: Xah | last post by:
Here's a interesting case of invalid html 4 strict file. In summary, if you have <body></bodywithout any content, the file would be invalid under html 4 strict. Valid if html 4 lose. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/ TR/html4/strict.dtd"> <html> <head> <META HTTP-EQUIV="Content-Type"...
0
7679
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...
0
8190
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...
1
7756
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...
1
5571
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5281
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3722
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...
1
2183
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1284
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1027
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...

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.