XHTML Interview Questions
There are many things that you can do ahead of time to prepare for the
interviewing process, and move yourself a step above of the competition.
Updating your resume and reviewing frequently asked interview questions can be
very effective, and goes a long way in getting the most out of your interview.
What is XHTML?
XHTML is a more formal, stricter version of HTML. XHTML is defined by an
XML dtd which makes it much easier to handle.
* XHTML stands for eXtensible Hyper Text Markup Language.
* It is aimed to replace HTML.
* It is almost identical to HTML 4.01
* It is the reformulation of HTML 4.01 as an application of XML.
* It is a stricter, tidier version of HTML.
XHTML 1.0 is the next level of coding as specified by the W3C.
XHTML is a transition / combination of HTML and XML. To change from HTML to
XHTML requires just a few changes in your coding styles. The main page to
check out is CONVERTING but all the others provide valuable information
about this coding technique as well.
XHTML provides the framework for future extensions of HTML and aims to
replace HTML in the future. Some resources refer to XHTML as HTML5.
XHTML 1.0 became an official W3C recommendation on January 26, 2000. A W3C
recommendation means that the specification is stable, that it has been
reviewed by the W3C membership, and that the specification is now a Web
standard.
XHTML 1.0 is the first step toward a modular and extensible web environment
based on XML (eXtensible Markup Language). It provides the bridge for web
designers to use a future based coding and still be able to maintain
compatibility with today's browsers.
XHTML is a stricter and cleaner version of HTML.
Answer:
* XHTML stands for EXtensible HyperText Markup Language
* XHTML is aimed to replace HTML
* XHTML is almost identical to HTML 4.01
* XHTML is a stricter and cleaner version of HTML
* XHTML is HTML defined as an XML application
* XHTML is a W3C Recommendation
XHTML is a combination of HTML and XML (EXtensible Markup Language).
XHTML consists of all the elements in HTML 4.01 combined with the syntax of
XML.
Advantages of using XHTML instead of HTML
1. Documents can be validated much easier
2. Documents can be transformed via tools like XSLT into other documents for
consumption by devices like handhelds
3. Fragments of documents can be retrieved faster
4. Text can be stored more effieciently in object oriented databases
Answer:
The great thing about XHTML, though, is that it is almost the same as
HTML, although it is much more important that you create your code
correctly. You cannot make badly formed code to be XHTML compatible. Unlike
with HTML (where simple errors (like missing out a closing tag) are ignored
by the browser), XHTML code must be exactly how it is specified to be. This
is due to the fact that browsers in handheld devices etc. don't have the
power to show badly formatted pages so XHTML makes sure that the code is
correct so that it can be used on any type of browser.
Answer:
XHTML combines XML and HTML 4 to provide developers with a language that
conforms to the XML format, as opposed to HTML which is based on SGML. XML
is much simpler to parse than SGML, and standards exist such as XSLT, XPath,
and XQuery for manipulating XML documents. Unfortunately, support for XHTML
in browsers is poor, with the leading browser, Microsoft Internet Explorer,
not supporting the XHTML mime type 'application/xhtml+xml'.
Why XHTML?
XHTML pages can be read by all XML enabled devices AND while waiting for
the rest of the world to upgrade to XML supported browsers, XHTML gives you
the opportunity to write "well-formed" documents now, that work in all
browsers and that are backward browser compatible
Since 1990, HTML (or Hyper Text Markup Language) has been the language
recommended for creating Web pages. And it has been very successful . But
HTML has its problems. Without going into specifics, as it's not the subject
of this article, HTML has become a mess. To sort this mess out, in 1999 the
World Wide Web Consortium came up with XHTML. XHTML stands for eXtended
Hyper Text Markup Language, and is written in a language called XML or
eXtended Markup Language.
As the name implies, XHTML has the capability to be extended. You can use
extra modules to do things with your pages that weren't possible with HTML.
The long-term goal is that your Web pages will be able to be understood by
computers as well as humans. How does this work? Allow me to explain.
You may be thinking that computers already understand Web pages because you
use a computer to view them. This is true. But computers only understand how
to display your pages, not what they mean. Imagine if computers did
understand what Web pages meant! You could tell your computer to go and
visit all of your local supermarket's Websites and report back to you on
which store is the cheapest for this week's shopping. Your computer could
visit the news sites around the world and bring back the latest headlines
that relate to things you're interested in. The possibilities are endless.
Differences between XML and HTML
Since XML and HTML are derived from SGML they are similar, but have the
following differences:
1. XML is case-sensitive
2. XML must have quotes (single or double) around attributes
3. Most interpreters of HTML are very forgiving about missing end tags - XML
parses are not.
4. Comments start with <-- and end with -->. Inside a comment, "--" may not
appear. Although this is fine in html, it confuses xml parsers.
How is XHTML better than HTML? Why would you want to use XHTML?
* to be able to take advantage of new coding techniques
* problems with the earlier versions have been fixed.
XHTML is a fairly close copy of HTML 4.01.
Extensibility : Under HTML, the addition of a new group of elements requires
alteration of the entire DTD. XML greatly eases the integration of new element
collections as it is a subset of SGML itself and specifies it's own DTD.
Portability : By the year 2002 as much as 75% of Internet access could be
carried out on non-PC platforms such as palm computers, televisions, fridges,
automobiles, telephones, etc. In most cases these devices will not have the
computing power of a desktop computer, and will not be designed to accommodate
ill-formed HTML as do current browsers.
Currently, the Netscape browser helps greatly for testing web pages by
displaying blank or broken pages when it comes across sloppy coding. IE is the
most forgiving browser and will show almost any page no matter the extent of
coding errors.
While HTML itself isn't completely lacking in extensibility or portability but
the evolution of it has been extremely slow compared to the pace of Internet
development. This fuels the problems encountered trying to make your pages work
on a wide range of browsers and platforms. XHTML will help to remedy those
problems.
How To Get Ready For XHTML?
XHTML is not very different from HTML 4.01, so bringing your code up to the
4.01 standard is a good start. In addition, you should start NOW to write your
HTML code in lowercase letters.
.
The Most Important Differences:
* XHTML elements must be properly nested
* XHTML documents must be well-formed
* Tag names must be in lowercase
* All XHTML elements must be closed
Why Code Your Own XHTML?
Programs that produce HTML for you often do so badly, often producing Web
pages that do things the long way. When you code your pages by hand you have an
intimate understanding of what you're doing, and can make the actual size of the
Web page file as small as possible. This decreases download times, so your pages
load faster and your users are happier.
When you use a program to generate HTML for you, you don't get the chance to
understand how your page is built internally because it's all done for you. This
is not a problem as long as everything works… but what if it doesn't? If you
find that your Web page doesn't display properly in Internet Explorer 4, and
many of your users use that browser, you're going to have to sort it out. This
means forgetting about the program and looking at the code yourself. Will you
see the problem? If you've been using the program to code the page for you, when
problems occur you probably won't have the knowledge you need to fix them.
The Internet is no longer limited to people with computers viewing Websites
through one or two different Web browsers. Everything has a Web browser in it
these days: mobile phones, televisions, personal digital assistants, cars… even
fridges! Blind users "view" Websites using speech synthesis or Braille devices.
There is no way you can test each page you produce in all the possible devices
on which it may be used.
But there is a way to ensure you have the best chance your site will work in
most scenarios: to produce pages using the standards laid out by the World Wide
Web Consortium (W3C), the people who work on XHTML and other Internet standards.
The W3C provide a validation service to check that your page meets the
standards, and if it does, it therefore has the best chance of being used on any
device.
How to build a "Hello World" page. With XHTML ?
"Hello World" Web page code looks like this:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello World</title>
</head>
<body>
<p>My first Web page.</p>
</body>
</html>
</p>
Why XHTML Modularization?
The XHTML modularization model defines the modules of XHTML.
XHTML is a simple, but large language. XHTML contains most of the
functionality a web developer will need.
For some purposes XHTML is too large and complex, and for other purposes it
is much too simple.
By splitting XHTML into modules, the W3C (World Wide web Consortium) has
created small and well-defined sets of XHTML elements that can be used
separately for simple devices as well as combined with other XML standards
into larger and more complex applications.
With modular XHTML, product and application designers can:
* Choose the elements to be supported by a device using standard XHTML
building blocks.
* Add extensions to XHTML, using XML, without breaking the XHTML standard.
* Simplify XHTML for devices like hand held computers, mobile phones, TV,
and home appliances.
* Extend XHTML for complex applications by adding new XML functionality
(like MathML, SVG, Voice and Multimedia).
* Define XHTML profiles like XHTML Basic (a subset of XHTML for mobile
devices).
What about elements that don't have a close tag, such as <IMG>
and <hr> ?
There are two solutions. You could use a close tag (e.g. <img src="logo.gif"
...></img>). However the best solution is to simply include a forward slash
in the element: <img src="logo.gif" ... />
Will this work?
As long as you include a space before the slash it will cause no problems in
most Web browsers - although there have been reports of problems with some
embedded HTML viewers such as Java's Swing HTML editor.
Why do we need modular DTDs?
An application may wish to support only a subset of XHTML. For example a
mobile phone, an Internet TV or even a Web-aware cooker may only require a
subset of XHTML. Also modularity makes it easier to deploy new developments.
Any other important new developments?
Yes: XSLT provides a transformation language which can be used to
transform XML documents into other formats. XSLT can be used to transform
documents from one XML DTD to another, or even to transform an XML document
to an alternative format such as RTF or PDF.
Why is this XSLT important?
You've heard all the hype about mobile phones and WAP haven't you? How do
you think the WAP world, which expects documents to be in WML format, to be
populated? Rather than manually creating WML markup, XSLT will enable XHTML
documents to be automatically converted to WML.
What's XHTML Validation?
An XHTML document is validated against a Document Type Definition.
Validate XHTML With A DTD
An XHTML document is validated against a Document Type Definition (DTD). Before
an XHTML file can be properly validated, a correct DTD must be added as the
first line of the file.
The Strict DTD includes elements and attributes that have not been deprecated or
do not appear in framesets:
!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
The Transitional DTD includes everything in the strict DTD plus deprecated
elements and attributes:
!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
The Frameset DTD includes everything in the transitional DTD plus frames as
well:
!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
This is a simple XHTML document:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>simple document</title>
</head>
<body>
<p>a simple paragraph</p>
</body>
</html>
Ampersands in hrefs must convert "&" to "&" in the URI
<a href="http://www.phonelists.com/cgi-bin/Handler.pl?ListID=Test&Password=test&action=View">Sample
List</a>
becomes
<a href="http://www.phonelists.com/cgi-bin/Handler.pl?ListID=Test&Password=test&action=View">Sample
List</a>
# The attribute "name" becomes "id" when used for a locator inside a document
For example, to reference a section within a document with a URI, we usually do
something like
"<a href="favoriteAnimals.html#meerkats">Meerkats</a>"
Inside the referenced section,
<a name="meerkats"><h2>Meerkats of Africa</h2></a>
becomes
<a id="meerkats"><h2>Meerkats of Africa</h2></a>
or better yet for backwards compatibility:
<a id="meerkats" name="meerkats"><h2>Meerkats of Africa</h2></a>
# Tidy
tidy is a tool to automatically convert HTML to XHTML. You can find it at
http://www.w3.org/People/Raggett/tidy/.
What's about an assumption with XHTML?
Serving XHTML with a MIME type of text/html is wrong. The whole point of
XHTML is that it's XML so that you can benefit from namespaces and the like. If
you serve it as text/html, you can't:
In particular, ‘text/html' is NOT suitable for XHTML Family document types that
adds elements and attributes from foreign namespaces, such as XHTML+MathML [XHTML+MathML].
Source: http://www.w3.org/TR/xhtml-media-types/#text-html
Two choices:
1. XHTML 1.0 served as application/xhtml+xml to conforming UAs, and text/html to
Internet Explorer
2. HTML 4.01, served as text/html
XHTML 1.1 is not an option because it mandates a MIME type of application/xhtml+xml
which is incompatible with Internet Explorer
How to writing XHTML demands a clean HTML syntax?
Some More XHTML Syntax Rules:
* Attribute names must be in lower case
* Attribute values must be quoted
* Attribute minimization is forbidden
* The id attribute replaces the name attribute
* The XHTML DTD defines mandatory elements
1. Attribute Names Must Be In Lower Case:
This is wrong:
<table WIDTH="100%">
This is correct:
<table width="100%">
2. Attribute Values Must Be Quoted:
This is wrong:
<table width=100%>
This is correct:
<table width="100%">
3. Attribute Minimization Is Forbidden:
This is wrong:
<input checked>
<input readonly>
<input disabled>
<option selected>
<frame noresize>
This is correct:
<input checked="checked" />
<input readonly="readonly" />
<input disabled="disabled" />
<option selected="selected" />
<frame noresize="noresize" />
Here is a list of the minimized attributes in HTML and how they should be
written in XHTML:
HTML XHTML
compact compact="compact"
checked checked="checked"
declare declare="declare"
readonly readonly="readonly"
disabled disabled="disabled"
selected selected="selected"
defer defer="defer"
ismap ismap="ismap"
nohref nohref="nohref"
noshade noshade="noshade"
nowrap nowrap="nowrap"
multiple multiple="multiple"
noresize noresize="noresize"
4. The id Attribute Replaces The name Attribute: HTML 4.01 defines a name
attribute for the elements a, applet, frame, iframe, img, and map. In XHTML the
name attribute is deprecated. Use id instead.
This is wrong:
<img src="picture.gif" name="picture1" />
This is correct:
<img src="picture.gif" id="picture1" />
Note: To interoperate with older browsers for a while, you should use both name
and id, with identical attribute values, like this:
<img src="picture.gif" id="picture1" name="picture1" />
IMPORTANT Compatibility Note:
To make your XHTML compatible with today's browsers, you should add an extra
space before the "/" symbol. The Lang Attribute
The lang attribute applies to almost every XHTML element. It specifies the
language of the content within an element.
If you use the lang attribute in an element, you must add the xml:lang
attribute, like this:
<div lang="no" xml:lang="no">Heia Norge!</div>
Mandatory XHTML Elements
All XHTML documents must have a DOCTYPE declaration. The html, head and body
elements must be present, and the title must be present inside the head element.
This is a minimum XHTML document template:
<!DOCTYPE Doctype goes here>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title goes here</title>
</head>
<body>
Body text goes here
</body>
</html>
Note: The DOCTYPE declaration is not a part of the XHTML document itself. It is
not an XHTML element, and it should not have a closing tag.
Note: The xmlns attribute inside the <html> tag is required in XHTML. However,
the validator on w3.org does not complain when this attribute is missing in an
XHTML document. This is because "xmlns=http://www.w3.org/1999/xhtml" is a fixed
value and will be added to the <html> tag even if you do not include it.
XHTML should be the master storage format for my resources?
NO! XHTML still lacks semantics. Ideally your resources should be stored
in an appropriate XML format. XSLT can then be used to convert the resources
to XHTML (for Web browsers), WML (for mobile phones), etc. XHTML is a useful
intermediate stage.
Can we get down to practicalities. How do I create XHTML pages?
The eGroups XHTML-L Web site provides links to XHTML tools, including
conversion tools and editors. A couple of free tools are available
(HTML-Kit, 1st Page 2000). Mozquito Factory appears to be the first licensed
package on the market.
You can expect the usual suspects (Microsoft, Dreamweaver, etc) to bring out
new versions of their products with XHTML support.
What about conversion of existing HTML pages - especially bulk
conversion, as I have many thousands of HTML files!
W3C has written a utility program called Tidy which can be used to
convert HTML pages to XHTML. Tidy can be used in batch mode to bulk-convert
documents. Tidy is an open source program, which has been incorporated into
an number of authoring tools, most notably HTML-Kit
What's the advantages of XHTML?
* Mixed namespaces
* Much simpler to work with (for programs, at least) than HTML
* You will immediately know when your document is not well-formed due to an
error from your UA.
What's XHTML DTD?
The XHTML standard defines three Document Type Definitions.
The most common is the XHTML Transitional.
The <!DOCTYPE> Is Mandatory
An XHTML document consists of three main parts:
* the DOCTYPE
* the Head
* the Body
The basic document structure is:
<!DOCTYPE ...>
<html>
<head>
<title>... </title>
</head>
<body> ... </body>
</html>
The DOCTYPE declaration should always be the first line in an XHTML
document.
An XHTML Example
This is a simple (minimal) XHTML document:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>simple document</title>
</head>
<body>
<p>a simple paragraph</p>
</body>
</html>
The DOCTYPE declaration defines the document type:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The rest of the document looks like HTML:
<html>
<head>
<title>simple document</title>
</head>
<body>
<p>a simple paragraph</p>
</body>
</html>
The 3 Document Type Definitions
* DTD specifies the syntax of a web page in SGML.
* DTD is used by SGML applications, such as HTML, to specify rules that
apply to the markup of documents of a particular type, including a set of
element and entity declarations.
* XHTML is specified in an SGML document type definition or 'DTD'.
* An XHTML DTD describes in precise, computer-readable language, the allowed
syntax and grammar of XHTML markup.
There are currently 3 XHTML document types:
* STRICT
* TRANSITIONAL
* FRAMESET
XHTML 1.0 specifies three XML document types that correspond to three DTDs:
Strict, Transitional, and Frameset.
XHTML 1.0 Strict
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Use this when you want really clean markup, free of presentational clutter.
Use this together with Cascading Style Sheets.
XHTML 1.0 Transitional
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Use this when you need to take advantage of HTML's presentational features
and when you want to support browsers that don't understand Cascading Style
Sheets.
XHTML 1.0 Frameset
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
Use this when you want to use HTML Frames to partition the browser window
into two or more frames
What the benefits of XHTML are?
As XHTML is an XML application, you will benefit from developments in the XML
world. For example XML tools such as editors, converters, browsers, etc. can be
used with XHTML resources. In addition there are developments to the XML family
of protocols and formats which will provide additional functionality for XHTML.
Attributes values must be in double or single quotes
<ol type=1>
becomes
<ol type="1">
or
<ol type='1'>
Every element must have an end tag, even when it doesn't really
matter.
<br>
<input type="text" value="Amazon.com" size="20" >
becomes
<br />
<input type="text" value="Amazon.com" size="20" />
For compatibility with older browsers its best to put a single space before the
'/'. Some browsers have trouble with "<br></br>" so its best to use "<br />"
.
How to convert most HTML pages to XHTML.
1. Heading lines at top
At the beginning of documents we need to include a few lines:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
The location of the dtd allows validating parsers to check the document. Most
browsers will ignore these tags.
Every attribute must have a value
<ol compact>
<input type="radio" name="title" value="decline" checked>decline</input>
becomes
<ol compact="compact" >
<input type="radio" name="title" value="decline"
checked="checked">decline</input>
What the benefits of XHTML are?
As XHTML is an XML application, you will benefit from developments in the XML
world. For example XML tools such as editors, converters, browsers, etc. can be
used with XHTML resources. In addition there are developments to the XML family
of protocols and formats which will provide additional functionality for XHTML.
Attributes values must be in double or single quotes
<ol type=1>
becomes
<ol type="1">
or
<ol type='1'>
Every element must have an end tag, even when it doesn't really matter.
<br>
<input type="text" value="Amazon.com" size="20" >
becomes
<br />
<input type="text" value="Amazon.com" size="20" />
For compatibility with older browsers its best to put a single space before the
'/'. Some browsers have trouble with "<br></br>" so its best to use "<br />"
How to convert most HTML pages to XHTML.
1. Heading lines at top
At the beginning of documents we need to include a few lines:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
The location of the dtd allows validating parsers to check the document. Most
browsers will ignore these tags.
Every attribute must have a value
<ol compact>
<input type="radio" name="title" value="decline" checked>decline</input>
becomes
<ol compact="compact" >
<input type="radio" name="title" value="decline"
checked="checked">decline</input>
How W3Schools Was Converted To XHTML ?
W3Schools was converted from HTML to XHTML.
To convert a Web site from HTML to XHTML, you should be familiar with the
XHTML syntax rules.
Your pages must have a DOCTYPE declaration if you want them to validate as
correct XHTML.
The following DOCTYPE declaration was added as the first line of every page:
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Be aware however, that newer browsers might treat your document differently
depending on the <!DOCTYPE> declaration. If the browser reads a document
with a DOCTYPE, it might treat the document as "correct". Malformed XHTML
might fall over and display differently than without a DOCTYPE.
Lower Case Tag And Attribute Names
Since XHTML is case sensitive, and since XHTML only accepts lower case HTML
tags and attribute names, a general search and replace function was executed
to replace all upper case tags with lowercase tags. The same was done for
attribute names. We have always tried to use lower case names in our Web, so
the replace function did not produce many real substitutions.
All Attributes Were Quoted
Since the W3C XHTML 1.0 Recommendation states that all attribute values must
be quoted, every page in the web was checked to see that attributes values
were properly quoted. This was a time-consuming job, and we will surely
never again forget to put quotes around our attribute values.
Empty Tags: <hr> , <br> and <img>
Empty tags are not allowed in XHTML. The <hr> and <br> tags should be
replaced with <hr /> and <br />.
This produced a problem with Netscape that misinterpreted the <br/> tag. We
don't know why, but changing it to <br /> worked fine. After that discovery,
a general search and replace function was executed to swap the tags.
A few other tags (like the <img> tag) were suffering from the same problem
as above. We decided not to close the <img> tags with </img>, but with /> at
the end of the tag. This was done manually.
The Web Site Was Validated
After that, all pages were validated against the official W3C DTD with this
link: XHTML Validator. A few more errors were found and edited manually. The
most common error was missing </li> tags in lists.
Downcase HTML tags, attributes, and HTML defined values
<BODY BGCOLOR="RED">
becomes
<body bgcolor="red">
(Capitols are ok in user defined attribute values like <img src="..."
alt="My Favorite Picture">.)
What XHTML does it stand for? How is if different from HTML? Who
developed it? ?
XHTML stands for "Extensible HyperText Markup Language". It was developed
by the World Wide Web Consortium (W3C) and is now a W3C Recommendation.
XHTML is a reformulation of HTML 4 in XML 1.0. This means that the benefits
provided by XML will be available to XHTML.
How does HTML differ from XHTML ?
XHTML has a small number of differences. The most noticeable being the
requirement for elements to be lowercase (e.g. <p> and not <P>) and elements
to be closed (e.g. paragraphs must end with a </p>).
Why to type a tags in uppercase, and never bother closing the paragraphs
?
For reasons on internationalisation XML elements are case sensitive. A
choice had to be made, and lowercase won on the day.
Tags may not overlap
This is <em> emphasized text and <b>bold </em>text</b>
becomes
This is <em>emphasized text </em> is <b>bold text</b>
Only certain tags may nest inside other tags
Looking at the dtd for xhtml, the definition of the "ol" element is:
<!ELEMENT ol (li)+>
<!ATTLIST ol
%attrs;
type %OLStyle; #IMPLIED
compact (compact) #IMPLIED
start %Number; #IMPLIED
>
This implies that an order list, "ol", element may not contain paragraph
tags or body text, just list items.
<ol>
These are some of my favorite animals:
<li>octopus</li>
<li>shrew</li>
<li>lemur</li>
and my most favorite
<li>meerkats</li>
</ol>
becomes
<p>These are some of my favorite animals:</p>
<ol>
<li>octopus</li>
<li>shrew</li>
<li>lemur</li>
<li>meerkats</li>
</ol>
|