xhtml Validation

J

Jimbo

I have tried validating a very simple xhtml page using w3's validator
software found here: http://validator.w3.org/ but I keep getting the
standard error message:
I was not able to extract a character encoding labeling from any of the
valid sources for such information. Without encoding information it is
impossible to validate the document. The sources I tried are:

a.. The HTTP Content-Type field.
b.. The XML Declaration.
c.. The HTML "META" element.
Could anyone tell me if I am doing something wrong? Here is my xhtml page
code:

<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!-- Fig. 4.5: links.html -->
<!-- Introduction to hyperlinks -->

<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Internet and WWW How to Program - Links</title>
</head>

<body>

<h1>Here are my favorite sites</h1>

<p><strong>Click on a name to go to that page.</strong></p>

<p><a href = "http://www.deitel.com">Deitel</a></p>

<p><a href = "http://www.prenhall.com">Prentice Hall</a></p>

<p><a href = "http://www.yahoo.com">Yahoo!</a></p>

<p><a href = "http://www.usatoday.com">USA Today</a></p>

</body>
</html>
 
H

Hywel Jenkins

I have tried validating a very simple xhtml page using w3's validator
software found here: http://validator.w3.org/ but I keep getting the
standard error message:
I was not able to extract a character encoding labeling from any of the
valid sources for such information. Without encoding information it is
impossible to validate the document. The sources I tried are:

a.. The HTTP Content-Type field.
b.. The XML Declaration.
c.. The HTML "META" element.
Could anyone tell me if I am doing something wrong? Here is my xhtml page
code:

You need some information about the character encoding in your <head>.
For example:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1" />
 
D

David Dorward

Jimbo said:
I have tried validating a very simple xhtml page using w3's validator
software found here: http://validator.w3.org/ but I keep getting the
standard error message:
I was not able to extract a character encoding labeling
http://www.htmlhelp.com/tools/validator/charset.html

Could anyone tell me if I am doing something wrong? Here is my xhtml page
code:

<p><strong>Click on a name to go to that page.</strong></p>

Its safe to assume that people know how to use a link. Not everybody
"clicks" to trigger a link though.
<p><a href = "http://www.deitel.com">Deitel</a></p>
<p><a href = "http://www.prenhall.com">Prentice Hall</a></p>
<p><a href = "http://www.yahoo.com">Yahoo!</a></p>
<p><a href = "http://www.usatoday.com">USA Today</a></p>

These look more like list items then paragraphs.
 
D

DU

Jimbo said:
I have tried validating a very simple xhtml page using w3's validator
software found here: http://validator.w3.org/ but I keep getting the
standard error message:
I was not able to extract a character encoding labeling from any of the
valid sources for such information. Without encoding information it is
impossible to validate the document. The sources I tried are:

a.. The HTTP Content-Type field.
b.. The XML Declaration.
c.. The HTML "META" element.
Could anyone tell me if I am doing something wrong? Here is my xhtml page
code:

<?xml version = "1.0"?>

I suggest you get rid of this <?xml version = "1.0"?>
for only 1 important and importantissimo reason:

When MSIE 6 for windows parses an html file, if the very first
instruction is a doctype in strict DTD, it will render the page in
standards compliant rendering mode (where, for instance, the box model
is compliant with W3C CSS1 TR). Otherwise, such in this case, it will
render the page in backward compliant rendering mode, therefore using an
invalid and incorrect CSS1 box model.

"An XML declaration is not required in all XML documents; however XHTML
document authors are strongly encouraged to use XML declarations in all
their documents."
http://www.w3.org/TR/2002/REC-xhtml1-20020801/#strict

Here, you have a very good and very defendable reason why you want to
remove that xml declaration.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!-- Fig. 4.5: links.html -->
<!-- Introduction to hyperlinks -->

<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Internet and WWW How to Program - Links</title>


I personally always add these lines in the <head> part of my files:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="date" content="2003-10-03T14:05:46+05:00" />
<meta http-equiv="imagetoolbar" content="no" />

That last instruction prevents the image toolbar from appearing when
someone in MSIE 6 for Windows hovers his mouse over an image.
</head>

<body>

<h1>Here are my favorite sites</h1>

<p><strong>Click on a name to go to that page.</strong></p>

Like others who answered you, this sort of "instruction manual"-like
directive is not really useful nor necessary. Adding an
a:hover {}
css rule for your links will be sufficient enough.
<p><a href = "http://www.deitel.com">Deitel</a></p>

Spaces between attribute names and attributes values (in between = sign)
are not necessary and
1- need to be removed anyway when the browser makes a syntaxical
analysis of the source code
2- coloring code editors will be confused and will not render the proper
color for attribute names and attribute values
so it's best to avoid adding spaces like that
<p><a href = "http://www.prenhall.com">Prentice Hall</a></p>

<p><a href = "http://www.yahoo.com">Yahoo!</a></p>

<p><a href = "http://www.usatoday.com">USA Today</a></p>

</body>
</html>

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 
E

Eric B. Bednarz

DU said:
Jimbo wrote:

I suggest you get rid of this <?xml version = "1.0"?>
for only 1 important and importantissimo reason:

When MSIE 6 for windows parses an html file, if the very first
instruction is a doctype in strict DTD,

A what?
it will render the page in
standards compliant rendering mode (where, for instance, the box model
is compliant with W3C CSS1 TR). Otherwise, such in this case, it will
render the page in backward compliant rendering mode, therefore using
an invalid and incorrect CSS1 box model.

Which spares you the trouble to compare the results with versions prior
to 6, spares you the trouble to solve a couple of bugs IE6 only sports
in so-called 'standards compliant' mode and spares you the trouble of
double-checking what IE6 does when 3rd party software like ad-blocking
proxies insert anything before the docHype declaration.

Of course, since M$IE cannot handle XHTML in the first place, we're
talking about serving XHTML syntax as text/html. The newsgroup
discussing voodoo is all the way down the corridor, 2nd door to the
left.
 
D

DU

Eric said:

doctype declaration: public identifier and system identifier.
Which spares you the trouble to compare the results with versions prior
to 6, spares you the trouble to solve a couple of bugs IE6 only sports
in so-called 'standards compliant' mode and spares you the trouble of
double-checking what IE6 does when 3rd party software like ad-blocking
proxies insert anything before the docHype declaration.

Of course, since M$IE cannot handle XHTML in the first place, we're
talking about serving XHTML syntax as text/html. The newsgroup
discussing voodoo is all the way down the corridor, 2nd door to the
left.

I tried to bring up a constructive and positive reply along with
suggestions to the OP. If your concern is about previous versions of
MSIE prior to version 6, then there are well known workarounds (tested,
verified and working) for MSIE 5.x incorrect box model.

Box Model Hack
http://tantek.com/CSS/Examples/boxmodelhack.html

Modified Simplified Box Model Hack
http://www.info.com.ph/~etan/w3pantheon/style/modifiedsbmh.html

AvoidingHacks
http://css-discuss.incutio.com/?page=AvoidingHacks

etc..

But before we discuss MSIE 5.x incorrect box model and how to
compensate, adjusting the source code, it should be known that a wide
majority of independent sources converge to say that more than 50% of
all web browsers in use on the web today is MSIE 6 for windows. if MSIE
6 is compliant with W3C web standards in a wide, large part, then why
not conform webpages to valid markup syntax, CSS1 properties and DOM1
attributes and methods?

It is in the best interests of web designers to make their page trigger
standards compliant rendering mode in MSIE 6 for windows for hundreds of
reasons. Many organizations and professional web designers have insisted
during months and years that Microsoft fix its broken box model. Now,
that it has been fixed in version 6, it's up to so-called web designers
to follow up on their own request and to be consequent, coherent.
Anything else is just jabbering cretinism dancing in colorized obscurantism.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 
M

Micah Cowan

Hywel Jenkins said:
You need some information about the character encoding in your <head>.
For example:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1" />

Isn't this a work-around for a buggy validator? If no external
charset information is available and the document is clearly XML
(via the XML declaration), and no character encoding is specified
in that declaration, then the character encoding *must* be one of
UTF-8 or UTF-16 (and the latter only if the Byte Order Mark is
present), right?

However, I do realize that the user agent "must not" assume a
character set for HTTP if none are indicated--though I think in
this case, it is clearly implied to be UTF-8. Anyway, I think
that "must not" rule is pretty silly at any rate: ASCII or a
derivative such as ISO-8859-1 or windows codepage 1250/1252 are
likely "best guesses".

-Micah
 

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,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top