views:

819

answers:

8

Ok, so I'm not quite sure the difference between these languages. Could someone clarify? I know that XML has user-defined tag and html is pre-defined, but thats basically the extent of my knowledge.

I know that HTML5 is supposed to replace HTML, but wasn't XML supposed to do that as well? Basically, which languages here are a substitute for the other, and which complement? Does XML replace XHTML?

+7  A: 

HTML is the HyperText Markup Language, which is designed to create structured documents and provide for semantic meaning behind the documents. HTML5 is the next version of the HTML specification.

XML is the Extensible Markup Language, which provides rules for creating, structuring, and encoding documents. You often see XML being used to store data and to allow for communication between applications. It's programming language-agnostic - all of the major programming languages provide mechanisms for reading and writing XML documents, either as part of the core or in external libraries.

XHTML is an XML-based HTML. It serves the same function as HTML, but with the same rules as XML documents. These rules deal with the structure of the markup.

Thomas Owens
Some of my descriptions could use a little work. Feel free to clean up any wording, if you want to. I'll try to poke in and clean it up later, as well.
Thomas Owens
Note that HTML5 updates XHTML as well. Also known as XHTML5.
Anne
GiH
+1  A: 

You can google or use wikipedia for exact definition. I'll just give an example:

HTML :

<DIV id=header>header</div>

XHTML:

<div id="header">header</div>

HTML 5:

<header>header</header>

XML is the syntax on which is based XHTML:

<something otherthing="stuff">content</something>
marcgg
HTML does also allow lowercase element names.
Gumbo
yes, but it also allow uppercase. that's why I put "DIV" and "div"
marcgg
+1  A: 

The standards for all those languages are maintained by the World Wide Web Consortium.

The exact differences and subtleties are beyond the scope of a question on stackoverflow, but w3schools.com has some tutorials that can help you get started on this.

I'd suggest reading the intro to each of the languages you asked about on w3schools. That should give you some idea as to the differences.

Ben S
A: 

HTML is a markup language made for Web pages. HTML 5 is the fifth version of HTML.

XML is another markup language. XHTML is a dialect of XML that closely resembles HTML and was meant to replace it, but due to poor support has basically just existed alongside HTML.

Chuck
+1  A: 

HTML is a markup language for web pages, while XML is a markup language for information. XML was never meant as a direct replacement for HTML, it has a different scope.

HTML 5 is just the latest version of HTML. The "current" version of HTML (the one supported by practically all browsers in use) is 4.01.

XHTML is a standard based on HTML that has been adjusted to conform to the stricter rules of XML. An XHTML document is also an XML document and if it's correctly written it can be parsed by any XML parser.

Guffa
The current version of HTML is 4.01.
Gumbo
@Gumbo: That's what I meant. ;)
Guffa
+2  A: 

XML is a syntax: it defines how you write data, but not what data you can write. For example:

<something otherthing="stuff">content</something>

HTML is a vocabulary: it defines what kinds of elements you can write (e.g. BODY, P, LI, etc.) but isn't very strict about how you write it (see "Tag soup");

XHTML is (approximately) the HTML vocabulary except written using the (much stricter) XML syntax. It's therefore (because the syntax is stricter) easier for software to parse, but it's harder for non-programmers to write correctly. It isn't very popular, because Internet Explorer doesn't support it properly.

HTML5 is the next-generation version of HTML (the current version of HTML 4), still in draft, not a standard yet, partially supported by some browsers (and so, experimental). HTML5 will explicitly support being served either using the XML syntax or as tag soup.

ChrisW
+2  A: 

XML is a meta language. A meta language is a language that provides a syntax mechanism for creating other languages without constraining expression through a predefined grammar. XML is defined in the SGML doctype language. Adherence to the strict syntax requirements of XML is called well-formedness, which is a practice of precise accuracy to a stated set of requirements in an effort to achieve uniform processing of a document across various different applications and user agents.

SGML is a meta language like XML and is even the parent of XML. SGML offers a broad form for defining data in uses of syntax without providing a data typing convention. Unlike SGML XML features a rigid and extremely simplified syntax that is not open to confusion. XML also features data type definitions also unlike SGML. Elements in XML provide namespace scope in a lambda fashion, while SGML provides no support for namespaces.

Doctype is an SGML based language that uses a syntax completely unlike XML for defining markup language grammars and broad data type conventions to tell data elements apart from text.

XML Schema is an XML written language that allows language grammar definitions with precise structural form in addition to specific data typing conventions for elements, structures, and attributes. Languages written in Schema structurally self-aware, unlike SGML vocabularies, so that they know of their own internal requirements at any various point in the structure. Languages defined by schema are able to be immediately open to validation through reference to the Schema document, due to the structural self-awareness, while languages defined in Doctype require unrelated software with static definitions to order to perform validation.

HTML 1.0 was written in English text and is neither SGML or XML.

HTML 2 - 4 are written in SGML and feature SGML flexibilities, such as uppercase tags or start tags without a matching closing tag.

XHTML 1.0 is an SGML defined form of the HTML language with some extended requirements to gleam progressive compatibility towards XML syntax.

XHTML 1.1 is the HTML language defined in XML with XML well-formedness requirements.

HTML5, like HTML 1.0, is not defined using any meta language. It is written in English text and moves radically in opposition of the uniform requirements of an XML serialization. HTML5 appears to be created for usability and media delivery without regard for structure or language hierarchies.

XHTML5 claims to be the XML compatible form of HTML5. Work on this specification is either not publicly disclosed or has not begun. Completion of this specification is unlikely as HTML5 introduces features that distances this form of HTML from serialization more so than any of its predecessors thereby making XHTML5 in conflict with itself.

XHTML5 is defined in the same spec as HTML5 even though the title of the spec is HTML5. The definition is public and has been in public for years.
hsivonen
A: 
karlcow