alex3 Posted April 22, 2009 Share Posted April 22, 2009 Lovely. All that was required was changing the DOCTYPE and removing some trailing slashes. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-816174 Share on other sites More sharing options...
FaT3oYCG Posted April 23, 2009 Share Posted April 23, 2009 I personally beleive that HTML 4.0 strict with lower case tag names and trailing slashes in singular tags is the best method of programming in html [...] Â You think deliberately putting syntax errors in your document is the "best method of programming"? That seems a bit odd to me. Â i beleive that this should eb the standard not tthat it is correct to any of the current ones, to me the slash indicates a closing so any tag that doesnt require an opening tag should require to be its own self closing tag hence why i think it should have trailing slashes Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-817553 Share on other sites More sharing options...
Daniel0 Posted April 23, 2009 Share Posted April 23, 2009 The slash does not and has never meant a self-closing tag. I'll repeat myself: HTML is not XHTML (and vice versa). Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-817557 Share on other sites More sharing options...
jcombs_31 Posted April 23, 2009 Share Posted April 23, 2009 Danielpedia.com !!!! Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-817747 Share on other sites More sharing options...
FaT3oYCG Posted April 24, 2009 Share Posted April 24, 2009 The slash does not and has never meant a self-closing tag. I'll repeat myself: HTML is not XHTML (and vice versa). Â i didnt say that all i said was that i was inputting my opinion and that having trailing slashs to me would make more sense, not that HTML or XHTML are the same as i know that they are not to be quite hinest i beleive that some of the things that have been changed / implemented into XHTML are stupid hence why i use HTML 4.0, i think someone in this thread has said it but im not sure, newest isnt always best and i beleive this to be true also. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-818102 Share on other sites More sharing options...
alex3 Posted May 2, 2009 Share Posted May 2, 2009 I just read this blog post. Not only ins Danial correct, it also shows how little a lot of web delevopers really know when putting some 'Valid XHTML 1.0' text on their sites. I'm very happy I took the (very small) effort to convert to strict, valid HTML 4.01. Should make it much easier for when HTML 5 reaches us. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-824297 Share on other sites More sharing options...
fry2010 Posted May 3, 2009 Share Posted May 3, 2009 Its funny cause every book and website tutorial you see suggest in their examples to use xhtml in the DTD. Plus as has already been stated before, most sites use it. It might not make it correct, but if everyone is doing it what difference does it make? Also rss feeds use xml and some other APIs, so thats another use for it. Having looked at some xml code i dont fancy learning it just yet mind. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-824673 Share on other sites More sharing options...
Axeia Posted May 3, 2009 Share Posted May 3, 2009 I'd just like to add to this topic that if you use xhtml 1.1 with the appriate header, you can't make use of an imagemap. You got 2 choices, you write invalid code, or it does not work in firefox. Â Most used browser by miles supporting xhtml actually served as xhtml so a bit hard to overlook. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-824784 Share on other sites More sharing options...
alex3 Posted May 4, 2009 Share Posted May 4, 2009 I'd say it just boils down to the fact it isn't valid code, which every seems to care about (and quite rightly). It just simply isn't valid, never mind if browsers cope with your mistake (which is a blessing and a curse: end users don't notice but you're not coding properly). Â The thing that actually got me is, XHTML has, for my needs, no advantages whatsoever, I was just swept up in the 'it's newer, let's use that' hype. And just because many sources use it for their DTDs, just means many sources are showing you invalid code (unless they're serving properly). Unfortuantly, you have to do your research on this one. Â In addition, I'd say HTML 5 is going to bring features that, while XHTML will have as it's being developed in tandem (I think), it just won't be worth sticking with XHTML because you'll have to serve it correctly, which IE can't handle (XHTML 1.1 needs serving properly to validate, so you can guarantee the next version will!). Â I'd rather validate my HTML 4.x now, so that it validates easily as 5 later. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-825536 Share on other sites More sharing options...
fry2010 Posted May 4, 2009 Share Posted May 4, 2009 Well upon hearing all this information and reading a lot about it I have to say I will be switching back to HTML strict and dropping this XHTML non-sense. I think the reason so many of us use it is because of that fact: Every body uses it! lol. I agree though that the singlular tags feel like they should have the ending / to signify they are closed. It just seems natural. But will have to break that bad habbit. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-825845 Share on other sites More sharing options...
rv20 Posted May 21, 2009 Share Posted May 21, 2009 You guys are forgetting 3 main points regarding xHTML. Â 1) The w3 guys are coding geeks and will love to make everthing symmetrical 2) They love xml and eventually want to do away with html this is their stepping stone to achieving that 3) This will somehow keep them in a job generating income in one way or another. They will no dount reciieve funding for their work, either government or sponsorship money, there are always ulterior motives. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-839048 Share on other sites More sharing options...
Daniel0 Posted May 21, 2009 Share Posted May 21, 2009 Care to cite your sources? Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-839053 Share on other sites More sharing options...
DarkSuperHero Posted May 23, 2009 Share Posted May 23, 2009 WOW! This thread had def opened my eyes. I always felt there was more to the html vs xhtml thing.... I will definitly be using html alot more than xhtml... Â ..does any one think that when HTML 5 is 'official' it will receive the hype that xHTML did? Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-840442 Share on other sites More sharing options...
KouK Posted June 29, 2009 Share Posted June 29, 2009 There really isn't any. It's personal choice. The idea behind XHTML was that it would be parsed using an XML mimetype (don't worry about what that is if you don't know), but IE doesn't support this, and since IE is the most used browser out there, it basically made XHTML pointless. Everyone just parses XHTML as HTML, and so they are eventually the same. Â If you want to make a wise choice, parse using a strict version of either of them, and not the transitional version. Then make sure that your code is valid. This is much more important and will have more benefits for your code than the choice between HTML and XHTML. Â Well said thanks! Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-865753 Share on other sites More sharing options...
eminentjob Posted July 9, 2009 Share Posted July 9, 2009 'x' is the only difference ...LOL Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-871886 Share on other sites More sharing options...
alex3 Posted July 14, 2009 Share Posted July 14, 2009 Seems that W3C has stopped working on XHTML 2.0 Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-875381 Share on other sites More sharing options...
saltedm8 Posted September 8, 2009 Share Posted September 8, 2009 this is a continuation of this discussion http://www.phpfreaks.com/forums/index.php/topic,266831.0.html  It is treated as html, but as I said, the xml is ignored, its not being parsed by the browser, as xml is ignored as it says here 'well-formedness errors may not be detected by user agents.', what its serving is html, so it cant be fake as the browser still sees it as html  php is ignored by a browser, and parsed by the php and 'spat out' as html, does that make php 'fake' html ?... no, it just means that browsers always parse as html and it needed a little help to parse it ( in the case of php ) .. does not mean its being read, its being ignored completely, so in the case of xml its doing the same thing, ignoring the xml, meaning what its serving to an end user is html, there is nothing 'fake' about it.   Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-914549 Share on other sites More sharing options...
Daniel0 Posted September 8, 2009 Share Posted September 8, 2009 php is ignored by a browser, and parsed by the php and 'spat out' as html, does that make php 'fake' html ?... no, it just means that browsers always parse as html and it needed a little help to parse it ( in the case of php ) .. does not mean its being read, its being ignored completely, so in the case of xml its doing the same thing, ignoring the xml, meaning what its serving to an end user is html, there is nothing 'fake' about it. Â Sorry, that's not how PHP works. Let's say we use Apache and PHP as a module. So, first you load the module. Then you add a line like this: AddType application/x-httpd-php .php in Apache's configuration file. What this line does is that it for any file with the extension .php, the MIME type should be application/x-httpd-php. However, the when you load the PHP module, Apache is being told all pages with the MIME type application/x-httpd-php should be sent by PHP first. When PHP is parsing a document it looks for things within <?php and ?> tags. Only data that is within these are PHP. Everything else is unknown and returned verbatim. So PHP parses things with the PHP tags (if there are any) and sets the Content-type to text/html (which can be changed by setting the default_mimetype directive or sending a header manually). Â That is entirely not what is going on when you send a text/html document to a browser. What that says is that the entire document is HTML, so the entire document will be treated as HTML. That is unlike PHP where only the things within its delimiters are treated as HTML. Now, an HTML parser is required to be forgiving, so whenever it meets something that is invalid or unknown it is required to try to correct it, insofar possible. Â But really, have you read this topic? If you have you'll know that the difference between HTML and XHTML is not just about syntax. The DOM will be different depending on which one you use. Â I don't think you said this yet, but many people claim that XHTML is better because it's stricter. That may or may not be true, but either way it's paradoxical that these particular people exploit the fact that HTML is forgiving to make their strict "XHTML" work. Â I'm not sure why you keep riding on that "fake" thing. Obviously you're not supposed to interpret it as fake in the literal sense. That's kind of why you use the little "" signs. The correct word is of course invalid. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-914587 Share on other sites More sharing options...
saltedm8 Posted September 8, 2009 Share Posted September 8, 2009 You must know more about php than me as I am a beginner to php as anyone worth their weight would have done their research, I agree with what you said in this forum, the only thing I am having problems with is the serving of xhtml, xhtml is an extension of html, as browsers use html and not xhtml of course its going to be served as html, but my argument was what you stated in the other thread that its fake html or invalid html.  as its being ignored, yes its pointless to use it unless you are using xml in your html ( aside from the fact its easier to learn ), but it does leave the option to add it later if you want, to me, that means its more accessible, obviously not because its 'better' but because it gives the option if you want to use it..  as its parsed as html it cant be invalid once it has reached the end user even if you have used text/html, simply because the xml parts of it are being ignored.  if I had something like this  'this can be seen [ 'this is ignored because its xml' ] by a browser', it would not parse as that, it would only parse as 'this can be seen by a browser,' so what it is serving is what is expected text/html, as such it cant be invalid... that's the way I look at it anyway Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-914605 Share on other sites More sharing options...
Daniel0 Posted September 8, 2009 Share Posted September 8, 2009 No, it doesn't just come down to that. Â Take this snippet for instance: <table> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr> </table> Â The DOM (Document Object Model) that is generated is not the same for the two content-types text/html (HTML) and application/xhtml+xml (XHTML). Â Try to check out these two things: http://daniel0.net/html_xhtml_test.php http://daniel0.net/html_xhtml_test.php?xhtml=1 Â The first one is an HTML 4.01 Strict document served as text/html. The second one is an XHTML 1.0 Strict document served as application/xhtml+xml. Both of them validate on W3C's validator with no errors or warnings. The PHP source code is: <?php $html = !isset($_GET['xhtml']); if (!$html) { header('Content-type: application/xhtml+xml; charset=utf-8'); echo <<<EOF <?xml version="1.0" encoding="utf-8"?> <!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"> EOF; } else { header('Content-type: text/html; charset=utf-8'); echo <<<EOF <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> EOF; } ?> <head> <?php if ($html): ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <?php endif ?> <title>Test (<?php echo $html ? 'HTML' : 'XHTML' ?>)</title> </head> <body> <table> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr> </table> </body> </html> Â As you see, the table is identical in both versions. Or is it? Well, no. In HTML, there is an optional <tbody> element, meaning it will be there whether you've put it in there or not. In XHTML there is no such thing as optional elements; either they are there or they are not. Â There are loads of other subtle (and less subtle) differences between HTML and XHTML. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-914616 Share on other sites More sharing options...
saltedm8 Posted September 8, 2009 Share Posted September 8, 2009 now thats what I call a lesson.. I am using a plug for firefox called 'page diff' amd you can see the difference in that, it must be using the dom to render as in the html one its  <table>   <tbody><tr>     <td>1</td>     <td>2</td>   </tr>   <tr>     <td>3</td>     <td>4</td>   </tr> </tbody></table>  and in the xml one its  <table>   <tr>     <td>1</td>     <td>2</td>   </tr>   <tr>     <td>3</td>     <td>4</td>   </tr> </table>  I stand corrected and beg forgiveness lol Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-914624 Share on other sites More sharing options...
saltedm8 Posted September 8, 2009 Share Posted September 8, 2009 I will ask though... if you are building a site properly using div tags, what would it add or take away that would make it invalid ?... Â if nothing, wouldn't that mean that its not invalid html so long as you have no tables at all? Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-914640 Share on other sites More sharing options...
Daniel0 Posted September 8, 2009 Share Posted September 8, 2009 The thing is that a document is only XHTML if its mime type is application/xhtml+xml, so that is what it takes to make it valid. However, Internet Explorer doesn't support that, so you'll have to do text/html instead, but if you do that it's no longer XHTML, but HTML with XHTML syntax, which is invalid. For instance <br /> is valid XHTML, but invalid HTML. It does work, but it is not correct/valid. It works because HTML is forgiving of errors. Â You have a couple of options: Use HTML syntax and MIME type text/html. This is valid. Use XHTML syntax and MIME type application/xhtml+xml. This is also valid, but you'll cut off all Internet Explorer users. Use XHTML syntax with MIME type text/html. This is invalid, but it does work (kind of). While a lot of people do it, it doesn't really make sense. First of all, your XHTML code will not be parsed as XHTML thus you will not be able to use any of the extra things XHTML offers (namespaces, etc.). Â Therefore, I think that using HTML 4.01 Strict is the best option right now. There is nothing wrong with XHTML per se, but it's not a viable option because Internet Explorer has got a large browser market share, but doesn't support XHTML. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-914792 Share on other sites More sharing options...
TheFilmGod Posted September 8, 2009 Share Posted September 8, 2009 Why is it that W3C uses xhtml when it doesn't seem to serve xml? It's all html to me. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-915061 Share on other sites More sharing options...
Daniel0 Posted September 8, 2009 Share Posted September 8, 2009 I don't know. I suppose you can send them an email and ask them that question. Quote Link to comment https://forums.phpfreaks.com/topic/148204-html-xhtml-any-difference/page/4/#findComment-915068 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.