Advance XHTML Programming Interview Preparation Guide
Download PDF

Learn basic and advance XHTML with hundreds of XHTML Interview Questions and Answers and examples.

26 XHTML Questions and Answers:

1 :: What Is XHTML?

XHTML stands for Extensible Hyper-Text Markup Language. XHTML is a scripting language that authors can use to embed text tags into a text document to add structural and formatting information.

More precisely, XHTML gives authors the means to:

► Publish online documents with headings, text, tables, lists, photos, etc.
► Retrieve online information via hypertext links, at the click of a button.
► Design forms for conducting transactions with remote services, for use in searching for information, making reservations, ordering products, etc.
► Include spread-sheets, video clips, sound clips, and other applications directly in their documents.

2 :: What Does an XHTML Document Look Like?

An XHTML document is a normal text file with predefined tags mixed with the text contents of the document. Tags are enclosed in pairs of angle brackets: "<" and ">".

Below is how a simple XHTML document will look like if you open it in a text editor:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<title>My First XHTML Document</title>
<p>Hello world!</p>

3 :: What Is the Relation between XHTML and HTML?

HTML (Hyper-Text Markup Language) is the original markup language for writing Web documents.

XHMTL 1.0 is basically the same language as HTML 4.0. But XHTML 1.0 is defined in XML 1.0 syntax. XHTML 1.0 offers the following features:

► XHTML documents are XML conforming. As such, they are readily viewed, edited, and validated with standard XML tools.
► XHTML documents can be written to operate as well or better than they did before in existing HTML 4-conforming user agents as well as in new, XHTML 1.0 conforming user agents.
► XHTML documents can utilize applications (e.g. scripts and applets) that rely upon either the HTML Document Object Model or the XML Document Object Model.

4 :: What Is the Relation between XHTML and XML?

XML (Extensible Markup Language) is a generic markup language to organize generic information into a structured document with embedded tags.

XHTML is entirely based on XML. You can actually say that XHTML is a child language of XML.

5 :: What Is the Relation between XHTML and the Web?

The Web is a publisher technology based on the Internet to allow publishers to publish hyper linked documents to be viewed by Internet users.

XHTML is the next generation language that used to compose those hyper linked documents. In another word, XHTML is the technical language that controls Web page contents and hyper links.

6 :: What Is the Relation between XHTML and HTTP?

HTTP (Hyper-Text Transfer Protocol) is an Internet communication protocol, that allows a viewer's computer talking to a publisher's computer to fetch XHTML documents.

The viewer's computer issues a HTTP request message to the publisher computer first. Then the publisher returns a HTTP response message back to the viewer's computer with the requested XHTML document included in the message.

The following diagram shows how HTTP works with XHTML documents:
HTTP Diagram

7 :: What Is the Relation between XHTML and URL?

URL (Uniform Resource Locator) is a compact string representation of the location for a Web document or other resource that is available on the Internet.

The URL of an XHTML document is usually the document file name prefixed with the domain name of your Web server and the http protocol name. As soon as you uploaded an XHTML document to a Web server, that document will have a URL to represent its location on the Internet. For example, if you have a Web server with domain name like, and you have uploaded an XHTML document called welcome.html, then the URL of that XHTML document on the Internet is

8 :: What Is URI?

URI (Uniform Resource Identifier) is a superset of URL. URI provides a simple and extensible means for identifying a resource in a more generic way. For example, the following strings are all valid URIs:

When an XHTML document is published on the Internet, its location can be represented by a URL, which is also a URI.

9 :: What Is the Relation between XHTML and SGML?

SGML (Standard Generalized Markup Language) is a metalanguage in which one can define markup languages, like HTML, for documents. SGML is a descendant of IBM's Generalized Markup Language (GML), developed in the 1960s by Charles Goldfarb, Edward Mosher and Raymond Lorie (whose surname initials also happen to be GML).

XHTML is not directly related to SGML. But it is indirectly to SGML through HTML.

10 :: What Is the Relation between XHTML and CSS?

CSS (Cascading Style Sheets) is a technical specification that allows XHTML document authors to attach formatting style sheets to XHTML documents. When XHTML documents are viewed as Web pages through Web browsers, the attached style sheets will alter the default style sheets embedded in browsers.