Lecture notes CISC103, 10/20/05 (1) Why XHTML and not HTML One answer comes from the XHTML spec itself: http://www.w3.org/TR/xhtml1 *********************************************************** XHTML 1.0: The Extensible HyperText Markup Language A Reformulation of HTML 4 in XML 1.0 *********************************************************** * Original purpose of HTML: "exchange of scientific and technical documents" * HTML: an application of SGML (Standard Generalized Markup Language). -- SGML: International Standard ISO 8879 from 1986 -- a "language for describing markup languages" -- "HTML is an example of a language defined in SGML." SGML: -- powerful, useful, stable, extensible... but complex -- HTML simplified SGML by providing: small set of tags for "authoring relatively simple documents" "HTML outgrew its original purpose": "rapid invention of new elements for use within HTML" "plethora of new elements has led to interoperability problems for documents across different platforms." (i.e. different code for different browsers, different kinds of computers) XML: Extensible Markup Language * "power and flexibility of SGML" but less complex XHTML: * a way of doing web documents like in HTML, but while following the rules of XML * New kinds of markup being invented all the time. * New kinds of accessing the Internet are being invented all the time. * In XML, you can add new kinds of markup more easily. * If new kinds of markup are defined according to XML and XHTML standards, they should work consistently in _all_ XML/XHTML compliant user-agents (browsers). * XHTML can be more easily adapted to various ways of accessing the internet. (2) Strictly Conforming Documents (From section 3.1.1 of the spec: ) What is a strictly conforming document? "A Strictly Conforming XHTML Document is an XML document that requires only the facilities described as mandatory in this specification." Translation: They should ALWAYS WORK because they use only MANDATORY features. Criteria for "strictly conforming": 1. The document must follow the rules of XHTML as expressed in one of the three DTDs. (more about this in a moment.) 2. The root element of the document must be html. 3. The root element of the document must contain an xmlns declaration for the XHTML namespace, e.g.: 4. There must be a DOCTYPE declaration in the document prior to the root element, and it has to be one of these three: 5. The DTD subset must not be used to override any parameter entities in the DTD. (Prof. Conrad says: I have no idea what this last one means, but I'll try to find out) An additional thing is strongly encouraged: "An XML declaration is not required in all XML documents; however XHTML document authors are strongly encouraged to use XML declarations in all their documents." That means you put the following on line one: "Such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16 and no encoding was determined by a higher-level protocol." What that means in practice is that if you are using a character set for some language other than English (e.g. an Asian language), the XML declaration is needed to say what the "encoding" of the document is... i.e. how to convert the bits (binary 1s and 0s) into characters that the browser can understand. Example of a conforming document: (Also saved as "template.html") Virtual Library

Moved to example.org.

Now... JavaScript