xhtml Validation Errors

J

John

Hello.

I am just learning to update html to xhtml and had a few validation
errors I wondered if you could help me with.

The first one says: The tag: "Area" is not allowed within: "area" It
is only allowed within; map.[xhtml 1.0 translation]

The second one says: Nesting error, "area" should be closed before
"map" [xhtml 1.0 translation]

The code in question is as follows:

<map name="navbarMap" id="navbarMap">
<area shape="rect" coords="1,0,62,20" href="index.htm" alt="Home">
<area shape="rect" coords="71,0,117,20" href="about.htm" alt="About">
<area shape="rect" coords="129,0,196,20" href="tours.htm" alt="Find
Tours">
<area shape="rect" coords="209,0,311,20" href="profiles.htm"
alt="Country Profiles">
<area shape="rect" coords="327,0,434,20" href="contact.htm"
alt="Contact An Agent">
</map>

If you can help me to understand this better I would be very grateful.

Thanks

John
 
D

David Dorward

John said:
I am just learning to update html to xhtml
Why?

The first one says: The tag: "Area" is not allowed within: "area" It
is only allowed within; map.[xhtml 1.0 translation]

That is true for every version of HTML which has said:
The second one says: Nesting error, "area" should be closed before
"map" [xhtml 1.0 translation]

http://www.w3.org/TR/xhtml1/#h-4.6

.... but you would probably benefit more from learning to use HTML 4.01
Strict before worrying about XHTML with its limited support from user
agents.

http://www.hixie.ch/advocacy/xhtml
 
J

Jukka K. Korpela

David Dorward said:
The first one says: The tag: "Area" is not allowed within: "area" It
is only allowed within; map.[xhtml 1.0 translation]

That is true for every version of HTML which has <area>.

That's right, but XHTML changes the rules of the game by its use of a
dummified metalanguage, XML. When parsed by SGML rules, _using DTD
information_, the <area> elements are no problem, since the browser knows
that an <area> element is empty and has no end tag. When parsed by XML
rules, every element must have an end tag, so when a generic XML
parse sees <area ...><area ...>, it regards this as an attempt to put an
<area> element inside an <area> element.

On the other hand, a _validator_ knows the <area> element is empty, even
when XHTML is used. Apparently the OP used a purported validator built
into an authoring tool, not a real SGML/XML validator such as
http://www.htmlhelp.com/validator/
When XHTML is used, a validator would report the lack of an end tag in
some way or another. It would be foolish to interpret the situation as an
attempt to nest <area> elements, since the DTD says that the content of
<area> must be empty.

If you play the XHTML game, you need to throw some slashes around. But
just stop playing until you have an idea of the rules of the game _and_
some idea of what you might possibly win in the game.
 
B

Big Bill

John said:
I am just learning to update html to xhtml
Why?

The first one says: The tag: "Area" is not allowed within: "area" It
is only allowed within; map.[xhtml 1.0 translation]

That is true for every version of HTML which has said:
The second one says: Nesting error, "area" should be closed before
"map" [xhtml 1.0 translation]

http://www.w3.org/TR/xhtml1/#h-4.6

... but you would probably benefit more from learning to use HTML 4.01
Strict before worrying about XHTML with its limited support from user
agents.

Please excuse my dumbness here but what do you mean by user agents?
I'm faced with optimising a site written in PHP/XHTML. The XHTML bit I
can live with but I've never used PHP. More to the point, the site
doesn't seem to be database driven. So why php? Dunno, and so far the
designer isn't saying. So I'd be interested to hear that XHTML isn't
universally adopted either. I'm thinking of redoing the site (only a
handful of pages with no likely expansion in the future) in simple but
well-optimised html and I'd be glad to hear any thing that would lend
support to my point of view.

BB
 
D

David Dorward

Big said:
Please excuse my dumbness here but what do you mean by user agents?

Software which interprets user agents. Such as Mozilla, or Googlebot.
So I'd be interested to hear that XHTML isn't
universally adopted either. I'm thinking of redoing the site (only a
handful of pages with no likely expansion in the future) in simple but
well-optimised html and I'd be glad to hear any thing that would lend
support to my point of view.

You quoted it.
 
W

Whitecrest

... but you would probably benefit more from learning to use HTML 4.01
Strict before worrying about XHTML with its limited support from user
agents.

Ahhh truer words were never spoken
 
W

Whitecrest

Please excuse my dumbness here but what do you mean by user agents?
Browsers

I'm faced with optimising a site written in PHP/XHTML. The XHTML bit I
can live with but I've never used PHP. More to the point, the site
doesn't seem to be database driven. So why php?

Even not database driven, it may still create pages based on choices the
user made of earlier pages. But since we don't know the site, we can't
say for sure "why"
Dunno, and so far the
designer isn't saying.

The designer or the developer? In most cases the designer doesn't know
the technical side of web sites, they know the business side (which is
equally important)
So I'd be interested to hear that XHTML isn't
universally adopted either.

It's not really supported by about 80%-90% of your visitors browsers.
But you can dumbify your pages to make it work on just about all of
them.
I'm thinking of redoing the site (only a
handful of pages with no likely expansion in the future) in simple but
well-optimised html and I'd be glad to hear any thing that would lend
support to my point of view.

Depending on the site, that may be a good plan. Again without knowing
the site and what they do, it is not something anyone can intelligently
comment on.
 
S

SpaceGirl

Whitecrest said:
Even not database driven, it may still create pages based on choices the
user made of earlier pages. But since we don't know the site, we can't
say for sure "why"


The designer or the developer? In most cases the designer doesn't know
the technical side of web sites, they know the business side (which is
equally important)


It's not really supported by about 80%-90% of your visitors browsers.
But you can dumbify your pages to make it work on just about all of
them.

Well that's not really true... carefully used XHTML works fine in IE, even
with the correcty doctypes. There are only a few specific things that it
chokes on, which can be avoided (same goes for CSS in IE, and nobody bitches
about that these days). Our last two sites were completely XHTML (more
logical), and worked fine across all the browsers we test with (IE, Mozilla,
FireFox, Opera - on PCs, Mac and Linux).
 
W

Whitecrest

Well that's not really true... carefully used XHTML works fine in IE, even
with the correcty doctypes. There are only a few specific things that it
chokes on, which can be avoided (same goes for CSS in IE, and nobody bitches
about that these days). Our last two sites were completely XHTML (more
logical), and worked fine across all the browsers we test with (IE, Mozilla,
FireFox, Opera - on PCs, Mac and Linux).

Which is what I said. You just said it a little more tactfully....
 
G

GD

SpaceGirl said:
Well that's not really true... carefully used XHTML works fine in IE,

No, XHTML deliberately sent as ordinary HTML works fine in IE but not
because IE is able to handle XHTML.

If IE receives a .html extension and a text/html content type from the
server it just interprets the page as HTML4. Then it comes across
trailing slashes in IMG and INPUT tags, and sees these as errors. Its
error-correction code just gets it past these syntax errors (which they
indeed are since the text/html page is being parsed as HTML just as you
asked) and it continues rendering the rest of the page.

Try making a *real* XHTML1.1 page and send it out with the content type
you're supposed to and see how far IE gets.

My first play with XHTML was a few years ago. Everything was fine when
loading off disk but imagine my surprise when I uploaded it all and
tried loading it over the web. Opera ignored half of the CSS, Mozilla
ground to a halt and soaked up 100% CPU until I killed it and IE couldn't
get past the DTD. These were in the days of IE5 and I understand that
someone at the W3C informed MS about the problem. About a year passed
and IE6 came out with exactly the same problem.

And the moral of the story: We all still use plain HTML, even if we fool
ourselves that we've attained enlightenment and mark up in XHTML because
at the end of the day the browsers we're sending the pages to are parsing
them as HTML. HTML with syntax errors in it, despite what the validator
says. Regardless of how well current versions of Mozilla and Opera handle
real XHTML those browsers are totally irrelevant since IE users outnumber
them almost 20:1.
 
T

Toby A Inkster

GD said:
Try making a *real* XHTML1.1 page and send it out with the content type
you're supposed to and see how far IE gets.

Contrary to popular belief it's not against the law to send XHTML as
text/html.
 
S

SpaceGirl

GD said:
No, XHTML deliberately sent as ordinary HTML works fine in IE but not
because IE is able to handle XHTML.

If IE receives a .html extension and a text/html content type from the
server it just interprets the page as HTML4. Then it comes across
trailing slashes in IMG and INPUT tags, and sees these as errors. Its
error-correction code just gets it past these syntax errors (which they
indeed are since the text/html page is being parsed as HTML just as you
asked) and it continues rendering the rest of the page.

Try making a *real* XHTML1.1 page and send it out with the content type
you're supposed to and see how far IE gets.

My first play with XHTML was a few years ago. Everything was fine when
loading off disk but imagine my surprise when I uploaded it all and
tried loading it over the web. Opera ignored half of the CSS, Mozilla
ground to a halt and soaked up 100% CPU until I killed it and IE couldn't
get past the DTD. These were in the days of IE5 and I understand that
someone at the W3C informed MS about the problem. About a year passed
and IE6 came out with exactly the same problem.

And the moral of the story: We all still use plain HTML, even if we fool
ourselves that we've attained enlightenment and mark up in XHTML because
at the end of the day the browsers we're sending the pages to are parsing
them as HTML. HTML with syntax errors in it, despite what the validator
says. Regardless of how well current versions of Mozilla and Opera handle
real XHTML those browsers are totally irrelevant since IE users outnumber
them almost 20:1.

Be careful to clean the sand out of your ears when you both to pull your
head out of that hole :)
 
W

Whitecrest

Be careful to clean the sand out of your ears when you both to pull your
head out of that hole :)

There's sand in his ass? (sorry, but someone had to say it)
 
M

MoonJihad

Hello.

I am just learning to update html to xhtml and had a few validation
errors I wondered if you could help me with.

The first one says: The tag: "Area" is not allowed within: "area" It
is only allowed within; map.[xhtml 1.0 translation]

The second one says: Nesting error, "area" should be closed before
"map" [xhtml 1.0 translation]

The code in question is as follows:

<map name="navbarMap" id="navbarMap">
<area shape="rect" coords="1,0,62,20" href="index.htm" alt="Home">
<area shape="rect" coords="71,0,117,20" href="about.htm" alt="About">
<area shape="rect" coords="129,0,196,20" href="tours.htm" alt="Find
Tours">
<area shape="rect" coords="209,0,311,20" href="profiles.htm"
alt="Country Profiles">
<area shape="rect" coords="327,0,434,20" href="contact.htm"
alt="Contact An Agent">
</map>

If you can help me to understand this better I would be very grateful.

Thanks

John

Your problem is that you do not close the area element. Since XHTML is
XML, all elements must be closed. For example:
<p>This is a paragraph.</p>

There also is a shorthand notation to close an element which cannot
contain text within it. For example :
<img src="someimage" alt="A pretty image" />

See the section 4.6 of the XHTML 1.0 spec
(http://www.w3.org/TR/xhtml1/#h-4.6)
 
J

John


I am just working through the lessons in a book on Dreamweaver, and
how to make a fictitious website future proof. Changing it to xhtml
is just part of the process towards making it more dynamic and
interactive, and accessible to everyone.
The first one says: The tag: "Area" is not allowed within: "area" It
is only allowed within; map.[xhtml 1.0 translation]

That is true for every version of HTML which has said:
The second one says: Nesting error, "area" should be closed before
"map" [xhtml 1.0 translation]

http://www.w3.org/TR/xhtml1/#h-4.6

... but you would probably benefit more from learning to use HTML 4.01
Strict before worrying about XHTML with its limited support from user
agents.

I'm not too bothered which I learn in at the moment, I'd just like to
learn it for myself instead of looking up the answers in the back of
the book :)

Do you know whereabouts I can go to see information on the area tags?

Thanks for your help

John
 
D

David Håsäther

John said:
I am just working through the lessons in a book on Dreamweaver,
and how to make a fictitious website future proof. Changing it to
xhtml is just part of the process towards making it more dynamic
and interactive, and accessible to everyone.

If that's really what your book says, I recommend you to not read
further.
 
B

Big Bill

Software which interprets user agents. Such as Mozilla, or Googlebot.


You quoted it.

Oh dear. XHTML bad, then, eh? and I suppose when you say mime, you
don't mean those guys dressed like clowns who always seem to be
trapped in glass boxes. I recognised the CDATA bit as I did a course
in XML years ago, actually finished it too. I came away from that
with the firm belief that if it can be done simply, then that's the
way to do it. This is probably why I do well, when allowed, at SEO as
the engines are basically bordering on the illiterate.

BB
 
B

Big Bill

Even not database driven, it may still create pages based on choices the
user made of earlier pages. But since we don't know the site, we can't
say for sure "why"


The designer or the developer? In most cases the designer doesn't know
the technical side of web sites, they know the business side (which is
equally important)


It's not really supported by about 80%-90% of your visitors browsers.
But you can dumbify your pages to make it work on just about all of
them.


Depending on the site, that may be a good plan. Again without knowing
the site and what they do, it is not something anyone can intelligently
comment on.

Then comment away, my good man. www.luxuryvillasspain.co.uk/ I was
thinking of doing away with the Sky ad but since "cheap flights" has
suddenly appeared very near the top of the "most searched for phrase
this week" at Wordtracker I may afford it a page of its own to try to
draw potential tenants in that way.

BB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top