Page II
XHTML: The Transition From
HTML to XML
The Cornerstone of a Portable, Modular
Language
XHTML 1.0's
technical innovations are only minor. However, by rendering HTML
compatible with XML, this slight technical evolution provides the
basis on which to build a portable (especially in terms of WAP
technologies) standard that will function in a modular manner.
Indeed, XHTML 1.1, the version on which the W3C is currently
working, is designed to break HTML up into different modules, each
of which is made up of a subgroup of HTML tags. The principal
modules are as follows:
- The structure module defines document structure.
Related
Tags: <body>,
<div>, <head>, <html>, <span>,
<title>
- The hypertext module defines hypertext link
management.
Related Tags: <a href>
- The basic text module is made up of the basic text
presentation tags.
Related Tags: <h1>...<h6>,
<p>, <pre>, <br>, <em>,
<strong>
- The list module defines list use.
Related Tags: <dl>,
<ol>, <ul>, <li>
The above modules are the ones a document needs in order to
be considered part of the XHTML family. The following secondary
modules can be added depending on an application's needs and the
functionality supported by the device in question:
- Other XHTML modules defined by W3C (for images, forms,
scripts, applets and so on).
- Customized modules created by the developer. As is the case
with XML, these modules must also match a DTD. TOP
Integrating This New
Standard
If you have to develop a Web site and you already know HTML
4, you will have no problem writing XHTML 1.0 documents. There are
just a few syntactic rules to apply so as to ensure XML
compatibility. You have two different solutions if you want to
migrate HTML pages to XHTML. You can either apply the below rules
manually or use available tools designed to convert documents
(presented later in the document).
Writing an XHTML 1.0 Document
More Rigorous
Syntax
Unlike HTML, an XHTML 1.0 document must be extremely
well-formed, which can be defined by the following rules:
Rule #1: All XHTML tags are included in the <html> root tag and
must be well-structured. For example:
<html>
<head>...</head>
<body>...<body>
</html>
Rule #2: Since
XML is case-sensitive, all names, tags and attributes must be
written in lowercase letters.
|
HTML
4.0 |
XHTML
1.0 |
|
<TD BGCOLOR="#ffcc33"> |
<td
bgcolor="#ffcc33"> |
Note: Attribute values can be written in lowercase or capital
letters. For example, the bgcolor attribute values
"#ffcc33" and #FFCC33" are
equivalent.
Rule #3: · Any tags that are not empty must be closed
systematically.
|
HTML
4.0 |
XHTML
1.0 |
|
Paragraph 1<p> Paragraph
2<p> |
<p>Paragraph 1</p> <p>Paragraph
2</p> |
Rule
#4: Empty tags must finish with a slash (/).
|
HTML
4.0 |
XHTML
1.0 |
|
<input...> <img
src="image1.gif"> |
<input.../> <img
src="image1.gif"/> |
Rule
#5: Overlapping tags are no longer authorized.
|
HTML
4.0 |
XHTML
1.0 |
|
<b><i>bold and
italic</b></i> |
<b><i>bold and
italic</i></b> |
Rule
#6: All attribute values must be placed between quotation marks (for
example, <table...
border="0">) and they can no longer be abbreviated.
|
HTML
4.0 |
XHTML
1.0 |
|
<input type="radio"...checked> |
<input type="radio"...
checked="checked"> |
Rule #7: The <script> and <style> tags must
contain a CDATA
section. In XML, this section, which is delimited by the <![CDATA[ and ]] > tags, indicates
that the information between these tags is data and does not need to
be parsed.
|
HTML
4.0 |
XHTML
1.0 |
|
<script language="JavaScript"> <!--
document.write("Hello World!"); //--></script>
|
<script
language="JavaScript"> <!-- <![CDATA[ document.write("Hello
World!"); ]]> //--> </script>
|
Onto Page III: The Transition From HTML to XML
Back to Page One: The Transition From HTML to XML
TechMetrix Research is a technically focused analyst firm focused on e-business application development needs. Based in Boston, Mass., the firm publishes comparison reports and product reviews designed to aid enterprises with decision making and to keep pace with the fast-moving e-business market.
TechMetrix is a U.S.-based subsidiary of SQLI, a European company that offers on-site development services to international organizations. SQLI specializes in e-business project development.