You are here: Re: What's wrong with this HTML (fails validation) ? « HTML « IT news, forums, messages
Re: What's wrong with this HTML (fails validation) ?

Posted by John Hosking on 02/15/07 04:17

robert maas, see http://tinyurl.com/uh3t wrote:

> [Omitted attributions for Jukka replaced] He spake, robert maas answered, Jukka replied:

>>>>The useful thing is that the validator reports the existence of an
>>>>error.
>>>
>>>That's not very useful at all when the error is reported several
>>>thousand lines after where the actual error happened.
>>
>>Not very useful, but useful. Knowing whether there is an error or
>>not is more information than not knowing whether there are errors
>>or not.

"Several thousand lines after where the actual error happened" would
indeed be a pain. But from what I saw in your OP and subsequent posts,
that wasn't the actual case. In fact, all the action occurred within
Line 1353.

> Well that depends on whether you consider the purpose of a
> validator to be:
> -1- Show the author where the error is, and explain what's wrong,
> so that the author can immediately fix it.
> -2- Flag the entire WebPage as INVALID, with no idea where the
> error actually is, so the author must post to a newsgroup
> asking for help, and spend several days before a single error
> can be fixed.
> I'll agree the W3C validator accomplished -2- in this case.

I think what'd be more accurate to say is that the W3C validator usually
hits in the range of your -1- above and about -1.7-, because some of the
error descriptions are unmistakeable but others take some studying and
experience.

>
>
>>On the contrary. A utility that reports mistakes (even on a
>>"There is an error" basis, though naturally I prefer more exact
>>reports) is often essential, but it is not a _substitute_ for
>>learning and understanding. Rather, an incentive and tool for them.
>
>
> Well so-far all I've learned is that:
> While <tag /> is a perfectly acceptable non-container XML tag, it's
> totally invalid as such in SGML, generating completely different
> longuange semantics, therefore must be totally avoided in any
> WebPage that is supposed to be transitional between HTML and XHTML.
> The br element is defined in a way that's totally incompatible
> between HTML and XHTML, so must be completely avoided in
> transitional WebPages.

You referred to W3C documents in another post (or was it in this one?),
so I guess this might not be too helpful. Still, I give you some
references in a little table which I hope you will find accurate and useful:

HTML: <br> and <hr>
http://www.w3.org/TR/html401/struct/text.html#h-9.3.2
http://www.w3.org/TR/html401/present/graphics.html#edef-HR

XHTML: <br/> and <hr/> or <hr></hr>
http://www.w3.org/TR/xhtml1/#h-4.6

XHTML Appendix C: <br /> and <hr />
http://www.w3.org/TR/xhtml1/#C_2
Include a space before the trailing / and > of empty elements, e.g. <br
/>, <hr /> and <img src="karen.jpg" alt="Karen" />. Also, use the
minimized tag syntax for empty elements, e.g. <br />, as the alternative
syntax <br></br> allowed by XML gives uncertain results in many existing
user agents.

SGML: Don't know. Haven't needed to care yet.
XML: Similarly not directly relevant to me here (but see above).

> There's a second validator that is very much different from the W3C
> validator and can help diagnose errors where the W3C validator gave
> an error apparently unrelated to anything wrong in the syntax.

Yes, it sometimes helps to get a second opinion.

> I have the same problem with movie titles, where indb.com maps from
> title to movie, and from actor in movie to all movies that starred
> that actor, but has no way to map from concept to movie title.
> For example for years I remembered a movie that had somebody go
> back in time and almost collide with themselves making the return
> trip, and then at the end the time machine is damaged causing the
> whole movie to repeat at hyper-speed. I couldn't find anyone who
> knew what that movie was. Finally a few years ago the movie
> appeared on TV again, and I was able to find the title: "Journey to
> the Center of Time".

If you register at IMDb (I assume you didn't really mean "indb") you
have access to the message boards. Sign on and go to the "I Need To
Know" board, where some people ask questions like yours and other people
pop up with the answers. IMDb also has search capabilities using
keywords, but the results are not always satisfying.



>>In this context, "net" (better written as "NET") means "null end
>>tag". When you have "<p /", you have a NET-enabling start tag,
>>i.e. a start tag that makes the next "/" act as the end tag for
>>the element that was opened. It's a nice idea in SGML, but it was
>>never implemented in HTML browsers, even though it was formally
>>part of HTML up to and including HTML 4.01.
>
>
> Ah, thanks for telling me that NET is an abbreviation, nothing to
> do with Visual Basic .NET, or InterNet, or net profit, etc., and
> for telling me what the abbreviation stands for. That's a start.
> Now I still don't know why it's called "null" and why it's called
> "end tag" and why it really acts like a start tag instead of a end
> tag, etc.

Well, look again. What you got was "Warning: net-enabling start-tag;"

I interpret that to mean that what was found by the validator is a
NET-enabling thing, meaning it enables a null end tag (and as Jukka
explained - for which I am grateful because I did not know this - that
means the next slash acts as an ending tag, apparently without the need
for a bracket >. And oh yeah, it *is* a start-tag *itself*, but it
enables a null end tag. Maybe you need to re-read Jukka's post more
carefully. (And I don't think he used any characters which the VT100
would mangle, so you shouldn't have to worry.)


>>>How the fuck do I get a horizontal rule any more???
>>
>>By using <hr>.
>
> That violates what I learned in the "Web Design" class.
> The instructor required two things:
> - Set up header (doctype etc.) as transitional.

If this is exactly what she said (i.e., that's *all* she said about it,
dogmatically), then she left out some important info. Transitional is
for legacy documents not yet cleaned up to validate as strict. I don't
know when you had your course, but there *was* a time when specifying a
transitional doctype was good advice (or at least, widely recommended;
Jukka or BTS or somebody will have the details).

For *new* pages, or pages you are actively maintaining, go with HTML
4.01 strict, unless you have a bona fide reason to use XHTML.

> - Never use an opening tag without the matching close tag.
> As you point out, neither br nor hr is compatible with those two
> rules.

Sure they are. You're letting yourself get confused. I think you're
hyperventilating. Sit down. ;-)

--
John

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация