Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > What's wrong with this HTML (fails validation) ?

Reply
Thread Tools

What's wrong with this HTML (fails validation) ?

 
 
robert maas, see http://tinyurl.com/uh3t
Guest
Posts: n/a
 
      02-12-2007
The URL for my Web page is:
<http://www.rawbw.com/~rem/HelloPlus/CookBook/CookTop.html>
The validation site is:
<http://validator.w3.org/>
When I ask it to validate my Web page, it gives me this error:
1. Error Line 1353 column 14: end tag for "EM" omitted, but its
declaration does not permit this.
<em>(reduce #'/ nums :end 9)</em><br />
+ You forgot to close a tag, or
+ you used something inside this tag that was not allowed, and
the validator is complaining that the tag should be closed
before such content can be allowed.
The next message, "start tag was here" points to the particular
instance of the tag in question); the positional indicator points
to where the validator expected you to close the tag.
&#x2709;
2. Info Line 1353 column 0: start tag was here.
<em>(reduce #'/ nums :end 9)</em><br />
3. Error Line 1353 column 32: end tag for element "EM" which is not
open.
<em>(reduce #'/ nums :end 9)</em><br />
The Validator found an end tag for the above element, but that
element is not currently open. This is often caused by a leftover
end tag from an element that was removed during editing, or by an
implicitly closed element (if you have an error related to an
element being used where it is not allowed, this is almost
certainly the case). In the latter case this error will disappear
as soon as you fix the original problem.

The / it's complaining about is in the middle of ordinary text, not
within any tag, so why is it even looking there to find anything
wrong? There's an opening EM tag at the start of the line, and a
matching closing tag near the end, with no tags of any kind
between. I see nothing wrong. What am I overlooking?
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      02-12-2007
robert maas, see http://tinyurl.com/uh3t wrote:
> The URL for my Web page is:
> <http://www.rawbw.com/~rem/HelloPlus/CookBook/CookTop.html>
> The validation site is:
> <http://validator.w3.org/>
> When I ask it to validate my Web page, it gives me this error:
> 1. Error Line 1353 column 14: end tag for "EM" omitted, but its
> declaration does not permit this.


<snip>

Don't now about that but one error is on line 53
.... and auto-repeated units (loops)<</a>/li>
^

And you have diagrams with '<' & '>' your need to encode entities for
especially in *X*HTML

&lt; &gt;

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      02-12-2007
On 12 Feb, 19:53, (E-Mail Removed) (robert maas, see http://
tinyurl.com/uh3t) wrote:
> The URL for my Web page is:
> <http://www.rawbw.com/~rem/HelloPlus/CookBook/CookTop.html>



> 1. Error Line 1353 column 14: end tag for "EM" omitted, but its
> declaration does not permit this.
> <em>(reduce #'/ nums :end 9)</em><br />


Congratulations! You might be one of the very few people to ever post
about validation problems here and to have actually exposed a real
flaw in the validator.

Your code is bogus, although probably not actually invalid. It's
littered with <p /> <br /> and <hr /> tags.

* This is HTML, not XHTML, so <br /> is wrong - just use <br>

* Your <p> elements aren't empty, so the empty tag <p /> is wrong.

* You appear to have confused <p> "paragraph wrapper element" with a
notion of it as "paragraph spacer tag". Replace [...] <p /> [...]
with <p>[...]</p> <p>[...]</p>

The try re-validating it.

It seems that the validator recently changed behaviours and started
accepting <br /> as valid HTML, when it used to reject it outright. I
haven't looked at the details, but there's a recent thread on it. This
is _strictly_ true, but horribly misleading to authors.

I neither know nor care whether this will cause the problem with <em>
that you're actually reporting. It's just not worth chasing these odd
ones until you've fixed the obvious stuff. One characteristic of
validators like this is that they usually report an error long after
the condition that really caused it.

 
Reply With Quote
 
Rik
Guest
Posts: n/a
 
      02-12-2007
On Mon, 12 Feb 2007 20:53:18 +0100, robert maas, see
http://tinyurl.com/uh3t <(E-Mail Removed)> wrote:

> The URL for my Web page is:
> <http://www.rawbw.com/~rem/HelloPlus/CookBook/CookTop.html>
> The validation site is:
> <http://validator.w3.org/>
> When I ask it to validate my Web page, it gives me this error:
> 1. Error Line 1353 column 14: end tag for "EM" omitted, but its
> declaration does not permit this.
> <em>(reduce #'/ nums :end 9)</em><br />
> + You forgot to close a tag, or
> + you used something inside this tag that was not allowed, and
> the validator is complaining that the tag should be closed
> before such content can be allowed.
> The next message, "start tag was here" points to the particular
> instance of the tag in question); the positional indicator points
> to where the validator expected you to close the tag.
> &#x2709;
> 2. Info Line 1353 column 0: start tag was here.
> <em>(reduce #'/ nums :end 9)</em><br />
> 3. Error Line 1353 column 32: end tag for element "EM" which is not
> open.
> <em>(reduce #'/ nums :end 9)</em><br />
> The Validator found an end tag for the above element, but that
> element is not currently open. This is often caused by a leftover
> end tag from an element that was removed during editing, or by an
> implicitly closed element (if you have an error related to an
> element being used where it is not allowed, this is almost
> certainly the case). In the latter case this error will disappear
> as soon as you fix the original problem.
>
> The / it's complaining about is in the middle of ordinary text, not
> within any tag, so why is it even looking there to find anything
> wrong? There's an opening EM tag at the start of the line, and a
> matching closing tag near the end, with no tags of any kind
> between. I see nothing wrong. What am I overlooking?


<p /> does not mean what you think it means.... A simple seach/replace
with <p> makes it valid.

Someone just recently pointed that out on a newsgroup, that in SGML
there's a shorttag feature of some kind, so that <h1/This is a header/ is
possible.

So:
<p /> Some text and then some and a / and then some more.
Is actually:
<p>> Some text and then some and a </p> and then some more.

I'm not aware of a browsers that renders it that way, but there's your
answer.
--
Rik Wasmus
 
Reply With Quote
 
Rik
Guest
Posts: n/a
 
      02-12-2007
And to bring it back to it's bare minimum (see
<http://www.positioniseverything.net/articles/mys-bug.html>, it's as true
for any script as for CSS):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3c.org/TR/html4/loose.dtd">
<html>
<head>
<title>"CookBook" toplevel</title>
</head>
<body>
<p /> Now we start another tag <em> which will be implicitly closed be the
following slash / Yes, the one we just had, as it closes the paragraph. So
this closing tag</em> doesn't close anything anymore, and will result in
yet another error.
</body>
</html>

--
Rik Wasmus
 
Reply With Quote
 
Rik
Guest
Posts: n/a
 
      02-12-2007
On Mon, 12 Feb 2007 21:26:17 +0100, Rik <(E-Mail Removed)> wrote:

> And to bring it back to it's bare minimum (see
> <http://www.positioniseverything.net/articles/mys-bug.html>, it's as
> true for any script


and/or markup

--
Rik Wasmus
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      02-13-2007
Scripsit Andy Dingley:

> Congratulations! You might be one of the very few people to ever post
> about validation problems here and to have actually exposed a real
> flaw in the validator.


Actually, no. He was however one of the few people who post about validation
problems and provide sufficient information, namely a URL.

> Your code is bogus, although probably not actually invalid.


It is actually invalid; see Rik's answers, or check
http://www.cs.tut.fi/~jkorpela/html/empty.html
(which discusses a more common problem, limited to XHTML-like syntax for
empty elements, where the issue is different - since a validator knows that
an HTML element like <br> has EMPTY declared content, it effectively treats
<br/> just as <br>> without looking for a matching "/").

> It's littered with <p /> <br /> and <hr /> tags.


Yes, that's the practical markup problem, and easy to fix.

> * Your <p> elements aren't empty, so the empty tag <p /> is wrong.


<p /> would be wrong even for an empty paragraph. By HTML rules, "<p /"
starts shorthand markup that will cause a matching "/" to be looked for. By
XML rules, "<p />" is a self-closing element, but the use of that syntax is
disallowed in XHTML that pretends to be compatible with "HTML user agents",
by the infamous Appendix C.

> It seems that the validator recently changed behaviours and started
> accepting <br /> as valid HTML, when it used to reject it outright.


Nope. I don't think there's any change. <br /> is formally valid HTML, it
just _means_ <br>>. It causes no error message. <hr /> might, in Strict HTML
4.01 in a context where only block-level elements are allowed, as directly
inside <body>, but that would be an error due to the ">".

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      02-13-2007
On 13 Feb, 06:31, "Jukka K. Korpela" <(E-Mail Removed)> wrote:

> > actually exposed a real flaw in the validator.

>
> Actually, no.


I would regard this as a flaw in the validator, in that it indicates
that simplistic pure DTD-based validation isn't adequate for an entry-
level HTML validator for use by inexperienced authors.

The OP has thrown their bogus code at the validator and they've
receieved an error message that's basically useless. This isn't a good
situation. Although three experienced HTML authors quickly spotted
the real problem, they did this by eyeballing the code, not owing to
any help from the validator.

> > Your code is bogus, although probably not actually invalid.

>
> It is actually invalid; see Rik's answers, or checkhttp://www.cs.tut.fi/~jkorpela/html/empty.html


Of course it's invalid in this case, the validator told us as much. I
was writing of the broader case where the mere use of <br /> or <p />
alone isn't always enough to make it invalid (after all, this page
managed 1300 lines before actually breaking).


> > It seems that the validator recently changed behaviours and
> > started accepting <br /> as valid HTML, when it used to reject
> > it outright.

>
> Nope. I don't think there's any change.


But if my fallible memory serves, this did used to be flagged as an
error? (the nit-picking valid interpretation notwithstanding) It
seems a backward step to have changed this. I suspect that it was done
to reduce "false positives"(sic) on Appendix C XHTML with <br />, but
that's far from a good thing to permit under a HTML doctype.

 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      02-13-2007
Scripsit Andy Dingley:

> I would regard this as a flaw in the validator, in that it indicates
> that simplistic pure DTD-based validation isn't adequate for an entry-
> level HTML validator for use by inexperienced authors.


The very meaning of "validation" in HTML context is "simplistic pure
DTD-based validation". If you want something else, give it some other name,
instead of confusing things by blaming a validator for being a validator.

Of course validation is of limited usefulness and can actually cause
problems instead of solving them. But that's a different issue.

The only reasonable reasons for recommending validators to Joe Wannabe
Webauthor is that they detect and report _some_ errors and the other
available HTML checkers confuse even more e.g. by issuing completely wrong
error messages and foolish warnings that reflect just their author's taste
and misconceptions.

> The OP has thrown their bogus code at the validator and they've
> receieved an error message that's basically useless.


The useful thing is that the validator reports the existence of an error.
The rest is more difficult, but as usual, we might expect people to check
back their HTML textbooks and tutorials when they encounter error messages.
Checking is not a substitute for learning and understanding.

> Of course it's invalid in this case, the validator told us as much. I
> was writing of the broader case


Here we go. "Invalid" and "valid" are well-defined words in the HTML
context. Leave it at that. You're not the guy drops here once a year to
advertize a phoney "validator", are you?

>>> It seems that the validator recently changed behaviours and
>>> started accepting <br /> as valid HTML, when it used to reject
>>> it outright.

>>
>> Nope. I don't think there's any change.

>
> But if my fallible memory serves, this did used to be flagged as an
> error?


Hardly. It would be an error to flag a valid document as erroneous.

You might confuse the W3C validator with the WDG validator
http://www.htmlhelp.com/tools/validator/
which gives (and has given for years) a useful warning, even though this is
strictly speaking outside the scope of a validator:

<br />
^Warning: net-enabling start-tag; possibly missing required quotes
around an attribute value

(It would be more understandable with "net" spelled as "NET" and with the
addition "or attempt to use XHTML syntax".)


--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
robert maas, see http://tinyurl.com/uh3t
Guest
Posts: n/a
 
      02-14-2007
> From: "Jonathan N. Little" <(E-Mail Removed)>
> > The URL for my Web page is:
> > <http://www.rawbw.com/~rem/HelloPlus/CookBook/CookTop.html>
> > The validation site is:
> > <http://validator.w3.org/>
> > When I ask it to validate my Web page, it gives me this error:
> > 1. Error Line 1353 column 14: end tag for "EM" omitted, but its
> > declaration does not permit this.

> Don't now about that but one error is on line 53
> ... and auto-repeated units (loops)<</a>/li>


Ah, thanks! The validation site totally failed to notice that! I
searched for all instances of <<, found that and another <</a>
later too, and found the several COUT << stuff in C++ examples and
changed them to use &lt; (I thought I had all those but I guess I
missed that one line with about six of those). I also looked for >>
just in case, but didn't find any at all in the whole file.

Checking validation again after just those fixes ... nope, didn't
help. Still got the same error at line 1353 as before.

> And you have diagrams with '<' & '>' your need to encode entities
> for especially in *X*HTML


I'm going to do one complete pass through the file searching for *all*
references to any of those three characters, which will take quite
a while, starting at 19:17 looking for & ... done at 19:19, not
a single mistake found, you must be halucinating, looking for all
instances of < next ... found this bogus syntax:
<li><a href="#deci">Decisions (branches) and auto-repeated units (loops)</a>/li>
Why did the validator miss that?? Fixing it now.
Found this bogus line:
Anything I haven't yet included might ... cited there.<br>
Should read, fixing it now:
Anything I haven't yet included might ... cited there.<br />
That's the sort of thing that could cause the symptom, so I'm re-validating
before finishing this scan, at 19:24 ... didn't help, back to scan...
I'm suspicious of this:
enter two numbers, with a space between them, such as
<pre>42 69</pre>on a single
line of input? Lisp will read the 42, and print it out on a new line.
So I'm going to spread it all out just to be safe:
enter two numbers, with a space between them, such as
<pre>
42 69
</pre>
on a single
line of input? Lisp will read the 42, and print it out on a new line.
Resuming the scan at 19:20 only 17% through the file... this is
taking too awfully long! At 19:34 I'm only 39% through the file.
I'm going to jump to the place where the problem occurs and search
backwards from there ... I don't see anything wrong for several screens.
I don't think this is the problem. I'm going to abort this scan and
read the rest of the ideas in the thread.

But thanks for that one correction, which helped me find another
just like it, even if that didn't fix validation.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
firefox html, my downloaded html and firebug html different? Adam Akhtar Ruby 9 08-16-2008 07:55 PM
Faulty css files or wrong html code? Peter Ostermann HTML 2 01-20-2008 01:02 PM
What's wrong in this HTML Source file Thaqalainnaqvi@gmail.com HTML 11 06-15-2006 04:15 AM
What's wrong in this HTML Source file of a Bank Thaqalainnaqvi@gmail.com Python 8 06-13-2006 09:43 PM
Is XML Doc wrong or is Schema wrong? (or both) Matthew XML 7 01-07-2005 10:05 PM



Advertisments