Sunday, November 25, 2012

XHTML

What  is XHTML?
The advantages of XHTML are:
-Since it is XML syntax, tools can easily parse and work with a XHTML document
-Tools can easily validate the structure of a XHTML document
-The structure of the document can be easily manipulated by the JavaScript DOM API to create
powerful and rich client side applications
-- This is the primary reason for us to use XHTML with AJAX applications
-XHTML provides a way to extend the default markup language This can lead to more specialized
languages


The DTD and MIME Type
- There are three separate DTD files to capture three types of structures
- -XHTML strict — Proper XHTML syntax. IE does not support this very well
- -XHTML transitional — The syntax matches HTML 4 more closely. Supported by all browsers. Recommended for now
- - XHTML frameset — Use this if you are using frames.
- The MIME type of XHTML should ideally be "application/xhtml+xml“
- However, IE does not support this. So, keep using the MIME type "text/html" until IE supports the actual MIME


The Basic Syntax
- The document should start with an XML preamble
-
- Next, the document must have a DOCWPE element and specify the DTD location
- "http://www.w3.org/TR/xhtml1lDTD/xhtm|1-
transitional .dtd" >

- Next, the root level element must be
- This and all other XHTML elements are defined in the "http://www.w3.org/1999/xhtml" namespace.
- It is recommended that you use an empty prefix for this namespace to simplify the document



"http://www.w3.org/TR/xhtm11/DTD/xhtm11-transitional.dtd“>





Differences With HTML 4
- In XHTML, all element names are in lower case
- - Valid in XHTML
- - Valid in HTML 4
- All elements must be nested properly
- Hel|o World.
- Valid
- Hel|o World
.
- Invalid XHTML- Some XHTML elements must have a body. They must have an end tag
- Hello World.
- Valid
- Hello World. - Invalid
- Some XHTML elements must not have any body
-
or

- Valid
-
or

- Invalid

- Attribute values must be quoted
- - Valid
- - Invalid
- An attribute must have a value
-



- In HTML 4, some elements (such as form and img) used the attribute "name" and "id" interchangeably to identify the element
- In XHTML, only the "id" attribute should be used
-

- In HTML 4, values of enumerated attributes were case insensitive. In XHTML, they must be
in lower case
- - Valid
- - Invalid for XHTML


Embedding Scripts and Styles
- The
-

No comments: