Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Which language to use?


  • Please log in to reply
1 reply to this topic

#1 Natalie15

Natalie15

  • Members
  • 9 posts
  • OFFLINE
  •  
  • Gender:Female
  • Local time:09:06 PM

Posted 09 March 2016 - 08:00 AM

I don't understand, is there a difference between html 5 and xhtml? Html 5 is a modern language, and my teacher says I have to use xhtml. I don't really understand, I know that there are some differences in syntax, but which one would you recommend to use?



BC AdBot (Login to Remove)

 


#2 UKHInside

UKHInside

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:12:06 PM

Posted 16 March 2016 - 09:23 PM

XHTML is a bit more strict in its implementation, and for good reason: its usefulness extends beyond its ability to be manipulated by humans. It is made to be more predictable, so that the outcome has less variance across different platforms and through difference circumstances.

 

First, by strictness, I simply mean that for both HTML5 and XHTML, you must follow certain guidelines for your code. For XHTML, these guidelines are more rigid, as an intent behind XHTML is for it to be usable by both computers and humans.

 

HTML5 will let you get away with more 'errors', so to speak, by accepting code despite improper usage of the language. XHTML will not allow you to get away with nearly so much as HTML5 will.

 

Since computers have difficulty interpreting anything that is not extraordinarily explicit in its outline, they usually require that you provide them with information very clearly, and according to the manner in which they expect to receive it.

 

A good question, then, would be: 'isn't the computer interpreting HTML5, too? And if so, why doesn't it require these stricter guidelines as it does for XHTML?'

 

The answer is that, yes, a computer (the browser on the visiting machine, or the server serving the data) is interpreting it, but browsers are made to be more lax; they will assume things when you provide them with 'erroneous' code. It's really not a big deal if you fail to load a reddit thread due to some unforeseen consequence of poorly managed code. You can often still run into unpredictable results due to these discrepancies, but it's simply not as frightening a consequence as it used to be.

 

However, if you have a more sensitive web application, and wish for it to be highly standardized and interpretable by any browser, or, say, you have a page that requires that the information be reliable (as an example, say that lives could potentially depend on this information being accurate to a fault), then you can't afford to make any such assumptions. Therefore, XHTML would be preferred for those implementations. It will not allow you to be so lax, and as a consequence, you will have to write stricter code to ensure that another computer (not always a browser!) that utilizes this information will be able to understand it in nearly all cases. Of course, for those cases in which something does break down somewhere along the chain, there will also be fail-safes built-in to handle them (often requiring the attention of a nearby human!), but nevertheless, this is an important difference between XHTML and HTML5, and a reason one might consider using XHTML over HTML5.

 

This is just one interpretation; mine. Really, so far as I understand it, the biggest singular difference is that XHTML can be read by XML parsers, while HTML5 may or may not be able to be read by those same parsers. That is the practical difference in a few words.

 

I'm not sure if this was helpful or not, nor if it is accurate to the level I would prefer it be, but I gave it a shot. Anyone with corrections or additional comments to make, please chime in! It wasn't until recently that I picked up web development, so my coding background is not anywhere close to centered around it.

 

You might risk asking your teacher why she or he insists upon XHTML, but it is likely due to the curriculum and how your code will be evaluated. That's my guess.


Edited by UKHInside, 16 March 2016 - 09:26 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users