XHTML explained

XHTML
Extension:.xhtml, .xht,
.xml, .html, .htm
Mime:application/xhtml+xml
Developer:WHATWG
Uniform Type:public.XHTML
Conforms To:public.xml
Owner:World Wide Web Consortium (W3C)
Genre:Markup language
Extended From:XML, HTML
Open:Yes
Standard:HTML LS

Extensible HyperText Markup Language (XHTML) is part of the family of XML markup languages which mirrors or extends versions of the widely used HyperText Markup Language (HTML), the language in which Web pages are formulated.[1]

While HTML, prior to HTML5, was defined as an application of Standard Generalized Markup Language (SGML), a flexible markup language framework, XHTML is an application of XML, a more restrictive subset of SGML. XHTML documents are well-formed and may therefore be parsed using standard XML parsers, unlike HTML, which requires a lenient HTML-specific parser.[2]

XHTML 1.0 became a World Wide Web Consortium (W3C) recommendation on 26 January 2000. XHTML 1.1 became a W3C recommendation on 31 May 2001. XHTML is now referred to as "the XML syntax for HTML"[3] [4] and being developed as an XML adaptation of the HTML living standard.[5] [6]

Overview

XHTML 1.0 was "a reformulation of the three HTML 4 document types as applications of XML 1.0".[7] The World Wide Web Consortium (W3C) also simultaneously maintained the HTML 4.01 Recommendation. In the XHTML 1.0 Recommendation document, as published and revised in August 2002, the W3C commented that "The XHTML family is the next step in the evolution of the Internet. By migrating to XHTML today, content developers can enter the XML world with all of its attendant benefits, while still remaining confident in their content's backward and future compatibility."[7]

However, in 2005, the Web Hypertext Application Technology Working Group (WHATWG) formed, independently of the W3C, to work on advancing ordinary HTML not based on XHTML. The WHATWG eventually began working on a standard that supported both XML and non-XML serializations, HTML5, in parallel to W3C standards such as XHTML 2.0. In 2007, the W3C's HTML working group voted to officially recognize HTML5 and work on it as the next-generation HTML standard.[8] In 2009, the W3C allowed the XHTML 2.0 Working Group's charter to expire, acknowledging that HTML5 would be the sole next-generation HTML standard, including both XML and non-XML serializations. Of the two serializations, the W3C suggests that most authors use the HTML syntax, rather than the XHTML syntax.[9]

The W3C recommendations of both XHTML 1.0 and XHTML 1.1 were retired on 27 March 2018,[10] [11] along with HTML 4.0,[12] HTML 4.01,[13] and HTML5.[14]

Motivation

XHTML was developed to make HTML more extensible and increase interoperability with other data formats.[15] In addition, browsers were forgiving of errors in HTML, and most websites were displayed despite technical errors in the markup; XHTML introduced stricter error handling.[16] HTML 4 was ostensibly an application of Standard Generalized Markup Language (SGML); however the specification for SGML was complex, and neither web browsers nor the HTML 4 Recommendation were fully conformant to it.[17] The XML standard, approved in 1998, provided a simpler data format closer in simplicity to HTML 4.[18] By shifting to an XML format, it was hoped HTML would become compatible with common XML tools;[19] servers and proxies would be able to transform content, as necessary, for constrained devices such as mobile phones.[20] By using namespaces, XHTML documents could provide extensibility by including fragments from other XML-based languages such as Scalable Vector Graphics and MathML.[21] Finally, the renewed work would provide an opportunity to divide HTML into reusable components (XHTML Modularization) and clean up untidy parts of the language.[22]

Relationship to HTML

There are various differences between XHTML and HTML. The Document Object Model (DOM) is a tree structure that represents the page internally in applications, and XHTML and HTML are two different ways of representing that in markup. Both are less expressive than the DOM – for example, "--" may be placed in comments in the DOM, but cannot be represented in a comment in either XHTML or HTML – and generally, XHTML's XML syntax is more expressive than HTML (for example, arbitrary namespaces are not allowed in HTML). XHTML uses an XML syntax, while HTML uses a pseudo-SGML syntax (officially SGML for HTML 4 and under, but never in practice, and standardized away from SGML in HTML5). Because the expressible contents of the DOM in syntax are slightly different, there are some changes in actual behavior between the two models. Syntax differences, however, can be overcome by implementing an alternate translational framework within the markup.

First, there are some differences in syntax:[23]

Notes and References

  1. Web site: SGML, XML, and XHTML . Adobe Help Center . 2016-09-30 . 2024-06-13 . Extensible Hypertext Markup Language (XHTML) is an extension of HTML that is based on XML and is designed to work with XML-based applications. .
  2. Web site: Graff . Eliot . Polyglot Markup: A robust profile of the HTML5 vocabulary . . 7 May 2014 . 17 October 2015 . 16 June 2022 . https://web.archive.org/web/20220616202318/https://dev.w3.org/html5/html-polyglot/html-polyglot.html . dead.
  3. Web site: Writing documents in the XML syntax. . live . https://web.archive.org/web/20230707043310/https://html.spec.whatwg.org/multipage/xhtml.html . 7 July 2023 . HTML Living Standard .
  4. Web site: The XML syntax. . live . https://web.archive.org/web/20230605155122/https://html.spec.whatwg.org/dev/xhtml.html . 5 June 2023 . HTML: The Living Standard .
  5. Web site: HTML vs. XHTML. whatwg.org.
  6. Web site: The WHATWG Blog. whatwg.org.
  7. Web site: 2007-06-16. 2000-01-26. World Wide Web Consortium. XHTML 1.0 Specification, Section 1: What is XHTML?.
  8. Web site: results of HTML 5 text, editor, name questions. W3C .
  9. Web site: HTML5 Working Draft, Section 1.6: HTML vs XHTML. 2011-02-16. 2011-01-13. World Wide Web Consortium.
  10. Web site: XHTML™ 1.0 The Extensible HyperText Markup Language (Second Edition) Publication History. World Wide Web Consortium.
  11. Web site: XHTML™ 1.1 - Module-based XHTML - Second Edition Publication History. World Wide Web Consortium.
  12. Web site: HTML 4.0 Publication History. World Wide Web Consortium.
  13. Web site: HTML 4.01 Publication History. World Wide Web Consortium.
  14. Web site: HTML5 Publication History. World Wide Web Consortium.
  15. Web site: 2007-06-16. 2000-01-26. World Wide Web Consortium. XHTML 1.0 Specification, Section 1.1: Why the need for XHTML?.
  16. Web site: How Did We Get Here? - Dive Into HTML5 . Pilgrim . Mark . diveintohtml5.info . 2016-06-11.
  17. Web site: 2008-12-29. Arjun Ray. 1999-10-06. ... However, since ISO 8879 does not afford applications the leeway to prohibit internal subsets, it follows that the letter of the HTML [4] spec automatically disentitles it to be a conforming SGML application.... Dropping the Normative Reference to SGML (was: I-D ACTION.). 2021-02-25. https://web.archive.org/web/20210225124458/https://markmail.org/message/drvncr3f6yscveeg. dead.
  18. Web site: XHTML—Myths and Reality . Tina Holmboe . The Developer's Archive . 2008-10-06 . 2008-12-29 . ... Since the design goals of XML itself partially mirrored those of the original HTML, it was logical for work to begin on formulating an XML–based markup language... . 2017-01-12 . https://web.archive.org/web/20170112181538/http://www.dev-archive.net/articles/xhtml.html . dead.
  19. Web site: Creating Web Utilities Using XML::XPath . Kip Hampton . XML.com . 2001-01-10 . 2008-12-29 . ... The problem: You want to take advantage of the power and simplicity that XML tools can offer, but you face a site full of aging HTML documents. The solution: Convert your documents to XHTML and put Perl and XML::XPath to work....
  20. Web site: Developing Wireless Content using XHTML Mobile . Jean-Luc David . XML.com . 2004-04-14 . 2008-12-29 . ... A useful feature of XHTML is that it can be manipulated as XML. Extensible Stylesheet Language Templates can be used to transform XHTML into WML or any other proprietary mobile formats....
  21. Web site: Namespaces Crash Course . Mozilla Developer Center . 2008-12-29 . ... It has been a long-standing goal of the W3C to make it possible for different types of XML-based content to be mixed together in the same XML file. For example, SVG and MathML might be incorporated directly into an XHTML-based scientific document... . 2008-10-02 . https://web.archive.org/web/20081002054459/http://developer.mozilla.org/En/SVG:Namespaces_Crash_Course . dead.
  22. Web site: HTML and XHTML Frequently Answered Questions . Steven Pemberton . . 2004-07-21 . 2008-12-29 . ... with an XML-based HTML other XML languages could include bits of XHTML, and XHTML documents could include bits of other markup languages. We could also take advantage of the redesign to clean up some of the more untidy parts of HTML and add some new needed functionality, like better forms....
  23. Web site: Comparison of SGML and XML . James . Clark . World Wide Web Consortium Note . 1997-12-15.