Select Category 
 

XHTML Interview Questions Answers

XHTML Interview Question - 1 : -

What's the advantages of XHTML?

XHTML Interview Answer - 1 : -

* 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.
 

XHTML Interview Question - 2 : -

What about elements that don't have a close tag, such as <IMG> and <hr> ?

XHTML Interview Answer - 2 : -

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.
 

XHTML Interview Question - 3 : -

What is XHTML?

XHTML Interview Answer - 3 : -

1  XHTML is a more formal, stricter version of HTML. XHTML is defined by an XML dtd which makes it much easier to handle.

2. 
* 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.

3.  
* 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


Answer4:
The great thing about XHTML, though, is that it is almost the same as HTML

 

XHTML Interview Question - 4 : -

What's XHTML Validation?

XHTML Interview Answer - 4 : -

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 "&amp;" 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="favoriteA

 

XHTML Interview Question - 5 : -

Why Code Your Own XHTML?

XHTML Interview Answer - 5 : -

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.
 

XHTML Interview Question - 6 : -

Any other important new developments?

XHTML Interview Answer - 6 : -

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.
 

XHTML Interview Question - 7 : -

Differences between XML and HTML

XHTML Interview Answer - 7 : -

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.
 

XHTML Interview Question - 8 : -

What's XHTML DTD?

XHTML Interview Answer - 8 : -

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 Interview Question - 9 : -

How to build a "Hello World" page. With XHTML ?

XHTML Interview Answer - 9 : -

"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>

 

XHTML Interview Question - 10 : -

Can we get down to practicalities. How do I create XHTML pages?

XHTML Interview Answer - 10 : -

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.
 

XHTML Interview Question - 11 : -

What XHTML does it stand for? How is if different from HTML? Who developed it? ?

XHTML Interview Answer - 11 : -

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.
 

XHTML Interview Question - 12 : -

XHTML should be the master storage format for my resources?

XHTML Interview Answer - 12 : -

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.
 

XHTML Interview Question - 13 : -

Why to type a tags in uppercase, and never bother closing the paragraphs ?

XHTML Interview Answer - 13 : -

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>

 

 

XHTML Interview Question - 14 : -

What's about an assumption with XHTML?

XHTML Interview Answer - 14 : -

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
 

XHTML Interview Question - 15 : -

Why do we need modular DTDs?

XHTML Interview Answer - 15 : -

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.