Information AboutXhtml |
| CATEGORIES ABOUT XHTML | |
| html | |
| markup languages | |
| w3c standards | |
| xml-based standards | |
|
The Extensible HyperText Markup Language, or '''XHTML''', is a Markup Language that has the same expressive possibilities as HTML , but a stricter syntax. Whereas HTML is an application of SGML , a very flexible markup language, XHTML is an application of XML , a more restrictive subset of SGML. Because they need to be ''well-formed'' (syntactically correct), XHTML documents allow for automated processing to be performed using a standard XML library — unlike HTML, which requires a relatively complex, lenient, and generally custom parser (though an SGML parser library could possibly be used). XHTML can be thought of as the intersection of HTML and XML in many respects, since it is a reformulation of HTML in XML. XHTML 1.0 became a World Wide Web Consortium (W3C) Recommendation on January 26 , 2000 . OVERVIEW XHTML is the successor to HTML. As such, many consider XHTML to be the “current version” of HTML, but it is a separate, parallel recommendation; the W3C continues to recommend the use of XHTML 1.1, XHTML 1.0, and HTML 4.01 for web publishing. The need for a more strict version of HTML was felt primarily because World Wide Web content now needs to be delivered to many devices (like Mobile Device s) apart from traditional Computer s, where extra resources cannot be devoted to support the additional complexity of HTML syntax. Most of the recent versions of popular is incompatible with some XHTML recommendations, despite Microsoft's full membership in the W3C. {Link without Title} Therefore, most web content authors are forced to choose between writing valid, standards-compliant documents and providing content that renders properly on the browsers of most visitors. An especially useful feature of XHTML is that elements from different XML Namespace s (such as MathML and Scalable Vector Graphics ) can be incorporated within it. However, this feature is only available when serving XHTML as actual XML with the application/xhtml+xml MIME -type. The changes from HTML to first-generation XHTML (i.e. XHTML 1.x) are minor, and are mainly to achieve conformance with XML. The most important change is the requirement that the document must be Well Formed and that all Element s must be explicitly closed as required in XML. Since XML's tags are case-sensitive, the XHTML recommendation has defined all tag names to be lowercase. This is in direct contrast to established traditions which began around the time of HTML 2.0, when most people preferred uppercase tags, generally to show the contrast between mark-up and context easier to the human editor. In XHTML, all attribute values must be enclosed by quotes (either 'single' or "double" quotes may be used). In contrast, this was optional in SGML, and hence in HTML, where quotes may be omitted in some circumstances. All elements must also be explicitly closed, including empty elements such as img and br. This can be done by adding a closing slash to the start tag: and . Attribute minimization (e.g., ) is also prohibited as the attribute “selected” contains no explicit value; instead, use . More differences are detailed in the W3C XHTML 1.0 recommendation {Link without Title} .VERSIONS OF XHTML XHTML 1.0 The original XHTML W3C Recommendation, XHTML 1.0, was simply a reformulation of HTML 4.01 in XML. There are three different "flavors" of XHTML 1.0, each equal in scope to their respective HTML 4.01 versions.
XHTML 1.1 The most recent XHTML W3C Recommendation is ''XHTML 1.1: Module-based XHTML''. This is based on XHTML 1.0 Strict using the . This version also allows for Ruby markup support, needed for East-Asian languages (especially CJK ). The modularization of XHTML allows small chunks of XHTML to be re-used by other XML applications in a well-defined manner. It also allows XHTML to be extended for specialist purposes. Note that such extended documents are not XHTML 1.1 conforming documents. For example, if you extend a document with the frameset module you can no longer claim the document is XHTML 1.1. Instead it might be described as an XHTML Host Language Conforming Document if the relevant criteria are satisfied. To be used correctly and conform XHTML must be DOM 2.0.01.a.xxx compliant. The XHTML 2.0 draft specification Work on XHTML 2.0 is, As Of 2006 , still underway. The XHTML 2.0 draft is controversial because it breaks backward compatibility with all previous versions, and is therefore, in effect, a new markup language created to circumvent (X)HTML's limitations rather than being simply a new version. Many issues with compatibility are easily addressed, however, by parsing XHTML 2.0 the same way a user agent would parse XHTML 1.1: via an XML parser and a default CSS document conforming to the XHTML 2.0 recommendation. New features brought into the HTML family of Markup Language s by XHTML 2.0:
Others in the XHTML family
VALIDATING XHTML DOCUMENTS An XHTML document that conforms to the XHTML specification is said to be a valid document. In a perfect world, all browsers would follow the web standards and valid documents would predictably render on every browser and platform. Although validating XHTML does not ensure cross-browser compatibility, it is a recommended first step. A document can be checked for validity with the W3C Markup Validation Service . DOCTYPEs / XML Namespaces / XML Schemas For a document to validate, it must contain a Document Type Declaration , or DOCTYPE. A DOCTYPE declares to the browser what Document Type Definition (DTD) the document conforms to. A Document Type Declaration should be placed at the very beginning of an XHTML document, even before the tag. These are the most common XHTML Document Type Declarations: ;XHTML 1.0 Strict : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN";XHTML 1.0 Transitional : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN";XHTML 1.0 Frameset : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN";XHTML 1.1 : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN";XHTML 2.0 XHTML 2.0 currently (Oct 2005) defines its DOCTYPE as : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 2.0//EN"In addition to the DOCTYPE, all XHTML elements must be in the appropriate XML Namespace for the version being used. This is usually done using an xmlns declaration in the root element.For XHTML 1.x this is : XHTML 2.0 requires a namespace and a XML Schema instance declaration, which might be declared as : <html xmlns="The System Identifier part of the DOCTYPE, which in these examples is the URL that begins with "http", need only point to a copy of the DTD to use if the validator cannot locate one based on the Public Identifier (the other quoted string). It does not need to be the specific URL that is in these examples; in fact, authors are encouraged to use local copies of the DTD files when possible. The public identifier, however, must be character-for-character the same as in the examples. Similarly the actual URL to the XML Schema file can be changed, as long as the URL before it, e.g., the XHTML 2.0 namespace, remains the same. Character Encoding may be specified at the beginning of an XHTML document in the XML declaration and within a meta http-equiv element. (If an XML document lacks encoding specification, an XML parser assumes that the encoding is UTF-8 or UTF-16, unless the encoding has already been determined by a higher protocol.)Common errors Some of the most common errors in XHTML are:
|
|
|