From Knowino
Jump to: navigation, search

XHTML 1.0 (eXtensible HyperText Markup Language version 1.0) is a computer language that has as its main goal the composing of documents for the World Wide Web. The rules for XHTML 1.0 were formally established on 26 January 2000.[1] The XHTML language is very similar to HTML version 4.01[2] whose standard was established a year earlier. The two languages share their vocabulary: elements, attributes, and character entities are identical. There are only a few minor syntactic difference (see the next section). The meanings (semantics), too, of the terms in the respective vocabularies are exactly the same. The languages do not only offer the same markup facilities for typesetting and layout, but also their hyperlinks are the same. Hyperlinks enable readers to switch with one mouse click to other places within a document and to other documents on the Web. Exactly as HTML 4.01, XHTML 1.0 is able to call scripts (pieces of computer code) that operate on objects of the Document Object Model (DOM). The DOM sees a document as a tree-like structure consisting of objects that have methods for traversal, augmenting, and modification of documents. These DOM methods may be invoked from HTML and XHTML by scripts in languages such as VBScript or JavaScript.

HTML 4 is the first version of HTML that is strictly conform SGML (Standard Generalized Markup Language, ISO 8879). The SGML standard is extensive and complex; a simplified version, named XML 1.0, appeared in 1998. XHTML 1.0 is an adaptation of HTML 4 to the XML 1.0 standard. The syntactic differences between HTML 4.01 and XHTML 1.0 are all due to the fact that XML requires a slightly stricter syntax than SGML.

A later version of XHTML 1.0 is XHTML 1.1,[3] which is not widely used. An ongoing development in the field is towards a new standard of HTML, provisionally called HTML5.

[edit] Differences of XHTML 1.0 with HTML 4.01

As said, the syntactic differences between HTML 4 and XHTML 1.0 are caused by the former being SGML-conform and the latter being XML-conform. The main differences are:

<span>This is a <strong>bold piece of text</span></strong>.
Many HTML based user agents (browsers, etc.) can handle such overlapping nesting, but from the point of view of XML the nesting in this example is malformed.
<li>here is the first item.
<li>here is the second item.
Correct is:
<li>here is the first item.</li>
<li>here is the second item.</li>
<table border=1>.
Correct are
<table border="1"> and <table border='1'>.
Both types of quotes ( ' and " ) are allowed, they are completely equivalent.
<hr></hr> and <hr />
<![CDATA[ if ( i < 0 && j > 0 ) { ... }; ]]>.

[edit] Valid XHTML

Valid XHTML is well-formed (syntactically correct) and in agreement with a DTD (Document Type Definition). The W3 (World Wide Web) Consortium made available three different DTDs for XHTML: strict, transitional, and frameset. The transitional DTD defines the same elements and attributes as the strict DTD, but in addition also attributes that are marked "deprecated" in the HTML 4.01 standard. All deprecated attributes dictate appearance and presentation (layout, fonts, etc), a task that is to be taken over by CSS (Cascading Style Sheets). The frameset DTD is applicable to documents that contain frames.

A valid XHTML document is associated with a DTD—identified by a URL (which by definition is unique)—by means of a <!DOCTYPE statement. For instance, for a strict document:

<!DOCTYPE html SYSTEM 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>,

where the string html refers to the root element of the document. The <!DOCTYPE statement comes before the root element.

XML 1.0 knows the concept of namespaces. All parts of a valid document are associated with (one or more different) namespaces. A valid XHTML document must be explicitly associated with at least one namespace, even when it is the default. An XML namespace is defined by the attribute xmlns, which must be an attribute of the root element when it has to cover the whole document. Hence a valid XHTML document must have a root element of the type:

<html xmlns="http://www.w3.org/1999/xhtml"> ,

where the URL is the address of a (default) namespace. Optionally, the natural language of the document may be specified as another attribute of <html>.

The validity of a document that is accessible from the internet can be checked by W3C validator.

[edit] References

  1. XHTML™ 1.0 The Extensible HyperText Markup Language (Second Edition)
  2. HTML 4.01 Specification: W3C Recommendation 24 December 1999 . Document defines the vocabulary of HTML 4.01 which is identical to that of XHTML 1.0.
  3. XHTML 1.1 - Module-based XHTML - Second Edition
Personal tools