Forum Moderators: open

Message Too Old, No Replies

Could you check my xhtml heading please

getting validation errors

         

Digmen1

8:08 pm on Mar 11, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hi guys

I have 2 small websites that I want to use XHTML and strict CSS etc.

I am getting a few simple validation errors about ending tags etc, I am sure that it is due to some simple error in my heading.

The code follows

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<meta name="keywords" content="keywords1, keyword2, keyword, etc," />
<link href="style_example.css" rel="stylesheet" type="text/css" />
<style type="text/css"> </style>
</head>

Kind Regards

Digby

[edited by: encyclo at 10:22 pm (utc) on Mar. 11, 2009]
[edit reason] exemplified [/edit]

CSS_Kidd

8:15 pm on Mar 11, 2009 (gmt 0)

10+ Year Member



What are the errors you are getting?

Digmen1

9:36 pm on Mar 11, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



Here is one error from Wc3 Validation tool

# Error Line 38, Column 97: end tag for "img" omitted, but OMITTAG NO was specified.

… height="323" alt="adkaf medium mug">

&#9993;

You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
# Info Line 38, Column 0: start tag was here.

<img src="images/adkafredblackfiremugmedium.jpg" width="400" height="323" alt=

Here is my code they are referring to

<img src="images/adkafredblackfiremugmedium.jpg" width="400" height="323" alt="adkaf medium mug">

This OMITTAG NO I cannot find any reference to.
If I add a </> to my code my text editor - Notepad ++ does not like it.

Thanks
Digby

[edited by: Digmen1 at 9:38 pm (utc) on Mar. 11, 2009]

g1smd

10:04 pm on Mar 11, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Change
mug">
to be
mug" />
and note the space before the slash.

However, do you really need this to be an XHTML document, or would HTML 4.01 Transitional or HTML 4.01 Strict be good enough?

Digmen1

10:14 pm on Mar 11, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks glsmd

I changed my code as you suggested and run it through the validator and it worked perfectly.

However my text editor notepad ++ does not like it.

No I probably don't need it to be XHTML as it is not a fancy multi-media site. But I did want to be up with the latest.

Is it easy for me just to change my header to HTML 4.01 Strict ?

I am writing it with Notepad ++ and Firefox, then checking IE7 occasionally. These are the only 2 I really need I think.

Digmen1

3:59 am on Mar 12, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hi Guys

I have now changed all my pages to HTML 4.01 Strict to make things a bit easier.

They are all working great on screen with Firefox and IE 6.

I have run my code through the validator and now have only 2 errors. They seem a bit strange, so I would like to fix them up.

Here my header details.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

and here are the errors

Error Line 3, Column 12: there is no attribute "XMLNS".

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

and

Error Line 3, Column 52: there is no attribute "XML:LANG".

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

Any assistance would be greatfully accepted.

Kind Regards

Digby

mattur

12:05 pm on Mar 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You don't need the XML stuff on the HTML element. Change:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

to

<html lang="en">

BTW:

No I probably don't need it to be XHTML as it is not a fancy multi-media site. But I did want to be up with the latest.

XHTML1 does not give you any fancy multi-media facilities. It is HTML4.01, in XML format. As things stand, XHTML is a dead end. With HTML5 on the horizon, HTML4.01 is generally the best option to use. HTH.

edited for typo

swa66

1:40 pm on Mar 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No I probably don't need it to be XHTML as it is not a fancy multi-media site. But I did want to be up with the latest.

XHTML1 does not give you any fancy multi-media facilities. It is HTML4.01, in XML format. As things stand, XHTML is a dead end. With HTML5 on the horizon, HTML4.01 is generally the best option to use.

Agree xhtml has nothing to do with fancy multimedia (perhaps even on the contrary).

But html5 will fortunately have a xhtml5 friend come along with it, and that means there is no dead-end for xhtml, fortunately for those of us who like to have the more structured xml and the ability to parse and process xhtml as if it were xml (now or in the future).

With xhtml it is incredibly important to make sure it's well structured (read:valid) code as _anything_ that 's wrong with it should result in major trouble. (read: it should not even render in a browser, unfortunately most of today's browser do render it anyway).

Which of html or xhtml is right is a debate I'm not really interested in. IMHO both a right and usable, use what you think is best for you: html for the flexibility (with the lack of enforced structure as a drawback), xhtml for the ability to process it as if it were xml (with the risk of keeping invalid code around).

I always use *valid* xhtml, and have no intention to return to html anytime soon. I use transitional xhtml every so often as today's browsers and services out there (think e.g. advertising) aren't up to dropping things like iframes.

(x)html 5 is still _many_ years away, the next generation of IE (IE8) will only barely make today's standards: aspects of CSS 1 -established in 1996- (the box model is in there) are still not properly implemented in the still widely used IE6. While IE8 might -I'm cautious, Microsoft has made too many twists and turns in the past for me to trust them till it's officially released- properly implement CSS2.1 it lacks most of what is being lined up for the future CSS3 in other browsers already and instead heavily focuses on the IE legacy.

Considering the massive deployed base of IE6 that's not even worried about upgrading away from IE6, there's little to hope for they will soon all use IE9 -or later, whichever will eventually support (x)html5-.

mattur

2:39 pm on Mar 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



swa66, yes you're right to call me on that.

(X)HTML5 also provides a road out of the "dead end" by allowing XHTML syntax in HTML documents. As you say the XML serialisation will be available too, though the HTML version is encouraged. So it's not really a "dead end", anyway. :)

Digmen1

6:41 pm on Mar 12, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks Mattur

You don't need the XML stuff on the HTML element. Change:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

to

<html lang="en">

I did not believe that it could be so simple !

phranque

8:01 am on Mar 13, 2009 (gmt 0)