Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > HTML to XHTML

Reply
Thread Tools

HTML to XHTML

 
 
Beauregard T. Shagnasty
Guest
Posts: n/a
 
      01-15-2011
Samuël van Laere wrote:

> I think that my real question should be:
> what is the real harm if the content type is incorrect?
> Seems to be there is none:
> IE would be able to open the page and display it (hopefully) correctly


I guess the answer is: "Maybe"

> Other UI's probally don't care and display it anyway


http://tekrider.net/html/htmlvalid.php

--
-bts
-This poast is valid through December 21, 2012
 
Reply With Quote
 
 
 
 
Samuël van Laere
Guest
Posts: n/a
 
      01-15-2011
Op 15-1-2011 6:30, Gus Richter schreef:
> On 1/14/2011 5:00 PM, Samuël van Laere wrote:
>> It has been some time since I last posted here.
>> Currently i'm considering moving from HTML 4.01 to XHTML since I think
>> it will make moving to HTML5 easier when that time comes.

>
>
> It is perfectly OK to remain with HTML4.01, but if your intent is to
> move to HTML5, then you can do so immediately without the need to
> consider XHTML as an interim move. You can do so immediately and very
> easily for any Standards/Strict HTML4.01 page and if it validates for
> HTML4.01, then it will validate for HTML5 if you simply change the
> Doctype to:
>
> <!DOCTYPE html>
>


Oke i've just changed it to that DOCTYPE.
I do not know why it doesn't validate at this point.
3 errors:
http://kubes.nl/


cheers,
Samuel


 
Reply With Quote
 
 
 
 
Samuël van Laere
Guest
Posts: n/a
 
      01-15-2011
Op 15-1-2011 13:41, Gus Richter schreef:
> On 1/15/2011 4:48 AM, Samuël van Laere wrote:
>>
>> As for the HTML5 doctype:
>> I have tried that but for some reason the W3C HTML validator doesn't
>> seem to agree that the page(s) validates.
>> It validates fine with the HTML 4.01 Strict doctype.

>
>
> BTW, by placing the meta charset in an HTML5 document anywhere else but
> first in the head element, you will find that the document will no
> longer validate as HTML5.
>
> As I wrote previously, "It must be immediately after the head element".
> This is for a security reason and the validator checks for this.
>


I've just commented in your other post in this thread.
I used the HTML5 DOCTYPE but 3 errors remain:
http://kubes.nl/
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      01-15-2011
Gus Richter wrote:

> BTW, by placing the meta charset in an HTML5 document anywhere else
> but first in the head element, you will find that the document will no
> longer validate as HTML5.


Which HTML5 draft are you referring? The current content of
http://dev.w3.org/html5/spec/Overview.html#charset
does not seem to say such a thing.


> As I wrote previously, "It must be immediately after the head
> element". This is for a security reason and the validator checks for
> this.


Which validator? The following passes http://validator.w3.org :

<!doctype html>
<title>foo</title>
<meta charset="utf-8">
<p>Hello world</p>

--
Yucca, http://www.cs.tut.fi/~jkorpela/
 
Reply With Quote
 
Gus Richter
Guest
Posts: n/a
 
      01-15-2011
On 1/15/2011 8:25 AM, Samuël van Laere wrote:
> Op 15-1-2011 13:41, Gus Richter schreef:
>> On 1/15/2011 4:48 AM, Samuël van Laere wrote:
>>>
>>> As for the HTML5 doctype:
>>> I have tried that but for some reason the W3C HTML validator doesn't
>>> seem to agree that the page(s) validates.
>>> It validates fine with the HTML 4.01 Strict doctype.

>>
>>
>> BTW, by placing the meta charset in an HTML5 document anywhere else but
>> first in the head element, you will find that the document will no
>> longer validate as HTML5.
>>
>> As I wrote previously, "It must be immediately after the head element".
>> This is for a security reason and the validator checks for this.
>>

>
> I've just commented in your other post in this thread.
> I used the HTML5 DOCTYPE but 3 errors remain:
> http://kubes.nl/



Excellent! It validates now in HTML5! I was going to point out your
errors. It could not have been validated in HTML 4.01 with the dimension
errors.
There are some differences in HTML5 as you found in the 1. Warning Line
that "The Content-Language state is obsolete." and the proper way is
<html lang="nl">

Some other differences are:
The default type for the STYLE element is "text/css" which is OK, but is
not required in HTML5.
<link rel="stylesheet" href="whatever.css">
and/or:
<style>
...
</style>
is all that is required.

Your line:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
is OK, but can be shortened in HTML5 to:
<meta charset="utf-8">
or you can use the HTTP header which is the preferred method and
overrider meta.

You should always specify a character encoding on every HTML document
and always place it first thing in the HEAD or bad things will happen
(security vulnerability). See:
<http://code.google.com/p/doctype/wiki/ArticleUtf7>

I am surprised that your page validates when not the first thing in the
HEAD since I had the experience that it would not validate in HTML5 if
placed after the TITLE element. I will have to check into this more when
time allows. In any case, do the advised due to security considerations.

Your page is now ready to also support the new HTML5 elements if and
when you wish to use them. You can use this site to check for browser
support of the new elements:
<http://caniuse.com/>

--
Gus

 
Reply With Quote
 
Gus Richter
Guest
Posts: n/a
 
      01-15-2011
On 1/15/2011 9:26 AM, Jukka K. Korpela wrote:
> Gus Richter wrote:
>
>> BTW, by placing the meta charset in an HTML5 document anywhere else
>> but first in the head element, you will find that the document will no
>> longer validate as HTML5.

>
> Which HTML5 draft are you referring? The current content of
> http://dev.w3.org/html5/spec/Overview.html#charset
> does not seem to say such a thing.
>
>
>> As I wrote previously, "It must be immediately after the head
>> element". This is for a security reason and the validator checks for
>> this.

>
> Which validator? The following passes http://validator.w3.org :
>
> <!doctype html>
> <title>foo</title>
> <meta charset="utf-8">
> <p>Hello world</p>



In my response to Samuel, I said:

You should always specify a character encoding on every HTML document
and always place it first thing in the HEAD or bad things will happen
(security vulnerability). See:
<http://code.google.com/p/doctype/wiki/ArticleUtf7>

I am surprised that your page validates when not the first thing in
the HEAD since I had the experience that it would not validate in
HTML5 if placed after the TITLE element. I will have to check into
this more when time allows. In any case, do the advised due to
security considerations.

Sorry for any confusion.
I have checked the page I found this to be still true as I described. I
have a lot of HTML comments beside the elements. Without all the HTML
comments it does not. I will have to conduct more tests.

BTW, see:
<http://dev.w3.org/html5/spec/Overview.html#the-head-element-0>
and

<http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-head-element-0>
where it is positioned as advised herein, but nowhere can I find any
mention of the exact position as advisable or a must. The best I came
across somewhere is that it should be near the top within the HEAD.

--
Gus

 
Reply With Quote
 
Gus Richter
Guest
Posts: n/a
 
      01-15-2011
On 1/15/2011 10:44 AM, Sherm Pendley wrote:
> Gus Richter<(E-Mail Removed)> writes:
>
>> For charset, HTTP header is preferred, but where not everyone can set
>> HTTP headers, meta may be shortened to:
>> <meta charset="utf-8">
>> which should always be included (expanded or short version), else it
>> can lead to security vulnerabilities. It must be immediately after the
>> head element.

>
> No. It must be *in* the head element, between its opening and closing
> tags.



Thank you for correcting me *again*, but you are incorrect. It must be
immediately after the HEAD opening tag, not just anywhere in the HEAD
element by saying "between the HEAD opening and closing tags", that is,
if you are concerned about the security vulnerability.

--
Gus

 
Reply With Quote
 
Allodoxaphobia
Guest
Posts: n/a
 
      01-15-2011
On Sat, 15 Jan 2011 07:41:31 -0500, Gus Richter wrote:
>
> As I wrote previously, "It must be immediately after the head element".
> This is for a security reason and the validator checks for this.


cite!
 
Reply With Quote
 
Gus Richter
Guest
Posts: n/a
 
      01-15-2011
On 1/15/2011 1:12 PM, Allodoxaphobia wrote:
> On Sat, 15 Jan 2011 07:41:31 -0500, Gus Richter wrote:
>>
>> As I wrote previously, "It must be immediately after the head element".
>> This is for a security reason and the validator checks for this.

>
> cite!



Just for you I'll restate what I wrote before:

You should always specify a character encoding on every HTML document
and always place it first thing in the HEAD or bad things will happen
(security vulnerability). See:
<http://code.google.com/p/doctype/wiki/ArticleUtf7>

--
Gus

 
Reply With Quote
 
Gus Richter
Guest
Posts: n/a
 
      01-15-2011
On 1/15/2011 12:04 PM, Sherm Pendley wrote:
> Gus Richter<(E-Mail Removed)> writes:
>
>> On 1/15/2011 10:44 AM, Sherm Pendley wrote:
>>> Gus Richter<(E-Mail Removed)> writes:
>>>
>>>> For charset, HTTP header is preferred, but where not everyone can set
>>>> HTTP headers, meta may be shortened to:
>>>> <meta charset="utf-8">
>>>> which should always be included (expanded or short version), else it
>>>> can lead to security vulnerabilities. It must be immediately after the
>>>> head element.
>>>
>>> No. It must be *in* the head element, between its opening and closing
>>> tags.

>>
>> Thank you for correcting me *again*

>
> If you can't deal with being corrected, double-check your claims before
> posting them. It's not that difficult.


I know that you were right. I therefore corrected myself. It was just
that you had no other comments except for the correction of same lapses.
It just smelled of someone jumping in to report a simple spelling
mistake. I thought, and still think, that I had an important message to
try and bring across to counter the numerous comments that HTML5 was not
ready or not supported. The corrections, although correctly done,
watered down the importance of the message - led away from it.

>> but you are incorrect. It must be
>> immediately after the HEAD opening tag

>
> For one thing, that isn't what you said - you said it must be immediately
> after the head *element*.


True and that was why I corrected it with "after the head opening tag".
I could have said that it must be the first thing in the head element.

I was correcting you then by describing a specific place in the head
element instead of just anywhere within it. Reason for that as I stated
several times here and elsewhere is found at:
<http://code.google.com/p/doctype/wiki/ArticleUtf7>

That would put it after the closing tag, and
> would result in invalid HTML. (Honestly Gus, I expected better of you.
> You've been around these parts for long enough to understand the diff-
> erence between a tag and an element...)


I would normally say "the first item in the HEAD element" and this led
me to my wrong wording. I thought about some readers having trouble with
this and therefore wanted to express it as "being the first item after
the HEAD opening tag". Sometimes I brain fart, so I mixed up my wording,
my bad. I'm not perfect.

> For another, the current HTML DTD does not define a required order in
> which the head element elements *must* appear. It may well be a good
> idea to place meta before title, but it's not a must.


Glad to see that you understand. On the other hand, if the security
vulnerability is of concern to you, it would behoove you to follow the
recommendation I pass on from the link I provided. It does not hurt.

>> not just anywhere in the HEAD
>> element by saying "between the HEAD opening and closing tags", that
>> is, if you are concerned about the security vulnerability.

>
> IMHO, a better way to avoid the browser bug you mentioned is to avoid
> using meta elements altogether. Setting up a local Apache instance for
> testing isn't exactly rocket surgery.


As I said before:
For charset, HTTP header is preferred, but where not everyone can
set HTTP headers, meta may be .......

--
Gus

 
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
PSD to XHTML Conversion, PSD to HTML, Joomla, Drupal, WordpressConversion, PSD to XHTML CSS xhtml champs XML 0 08-02-2011 05:40 AM
PSD to XHTML Conversion, PSD to HTML, Joomla, Drupal, WordpressConversion, PSD to XHTML CSS xhtml champs C Programming 0 08-01-2011 06:29 AM
convert xhtml to another xhtml using xslt Usha2009 XML 0 12-20-2009 01:13 PM
Should I Convert Site To XHTML or XHTML mobile? chronos3d HTML 9 12-05-2006 04:46 PM
parse URL (href) from xhtml, xhtml -> text, for data hawat.thufir@gmail.com XML 7 02-08-2006 07:39 PM



Advertisments