Extensible Hyper-Text Markup Language (XHTML) Interview Questions and Answers
Extensible Hyper-Text Markup Language (XHTML) Interview Questions and Answers
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.
► 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.
Below is how a simple XHTML document will look like if you open it in a text editor:
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.
XHTML is entirely based on XML. You can actually say that XHTML is a child language of
XML.
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.
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
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 questions-
interviews.com, and you have uploaded an XHTML document called welcome.html, then the
URL of that XHTML document on the Internet is http://www.questions-interviews.com/html
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:
ftp://ftp.is.co.za/rfc/rfc1808.txt
http://www.ietf.org/rfc/rfc2396.txt
ldap://[2001:db8::7]/c=GB?objectClass?one
mailto:[email protected]
news:comp.infosystems.www.servers.unix
tel:+1-816-555-1212
telnet://192.0.2.16:80/
urn:oasis:names:specification:docbook:dtd:xml:4.1.2
When an XHTML document is published on the Internet, its location can be represented by a
URL, which is also a URI.
XHTML is not directly related to SGML. But it is indirectly to SGML through HTML.
Since XHTML is a specific type of XML documents, you can use DTD to define the structure of
XHTML. In fact, XHTML 1.0 Strict version is defined in DTD as shown at
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd.
Who Developed XHTML?
XHTML was developed by W3C HTML Working Group with Steven Pemberton as the group
chair.
► By URL - Specify the URL where your XHTML document is located, and click "Check".
► By File Upload - Use the "Browse" to locate an XHTML document on your local hard disk,
and click "Check".
► By Direct Input - Copy & paste the content of an XHTML document to the input area, and
click "Check".
If you are looking for some advanced tools to help you writing XHTML documents, you can
select any one from the following three categories of XHTML editors:
► Text based editor - Allows you to work on the text version of the XHTML document.
► WYSIWYG editor - Allows you to work on the rendered version of the XHTML document.
► Browser based editor - A WYSIWYG editor integrated into an existing Web browser.
XHTML editors can also be loaded with additional functionalities to allow you work with other
Web technologies like CSS and JavaScript, or publish the XHTML documents to your Web
server.
The following tutorial shows you how to view a XHTML document with :
Here is a how your XHTML document, hello.html, will look like if viewing it with IE:
Hello in IE
<a href="http://www.questions-interviews.com/">questions-interviews.com</a>
► A name called "a", which is coded at the beginning of the opening tag.
► An attribute called "href", which is coded inside the opening tag. It also has a value specified
after the "=" sign.
► A string of text as the content, which is coded between the opening tag and closing tag.
<script type="text/javascript">
<!-- alert("Are you ok?"); -->
</script>...
XHTML element names are predefined by the XHTML specification. You can not make up your
own tag names. Here are some good examples of XHTML element opening tags:
► Using a closing tag, which is the element name prefixed with "/" and enclosed in a pair of
angle brackets: "<" and ">".
► Closing the opening tag immediately by placing "/" before the ending bracket: ">".
<p>
I love the way you look at me,<br>
Your eyes so bright and blue.<br>
I love the way you kiss me,<br>
Your lips so soft and smooth.<br>
</p>
But that paragraph will be invalid as XHTML documents, because all 4 <br> are not closed. You
should change it to:
<p>
I love the way you look at me,<br/>
Your eyes so bright and blue.<br/>
I love the way you kiss me,<br/>
Your lips so soft and smooth.<br/>
</p>
But all those <meta> tags are invalid in a XHTML document. They must be closed as:
Note to HTML document authors: <meta> tag syntax in XHTML is the opposite to <meta> tag
syntax in HTML. In XHTML, meta tag must be closed. But in HTML, meta tag can not be
closed.
Note to HTML document authors: HTML element names are not case sensitive. But XHTML
element names are case sensitive. If you are converting existing HTML documents to XHTML
documents, you will get a lots of syntax errors about upper case letters used in HTML tags.
► <br/> - No attribute.
► <script type="text/javascript"> - One attribute: "type".
► <p class="sideNote"> - One attribute: "class".
► <meta name="Author" content="questions-interviews.com"/> - Two attributes: ► <img src="ggl.gif"
alt="ggl"/> - Two attributes: "src" and "alt".
The HTML DOM defines the objects and properties of all HTML elements, and the methods
(interface) to access them.
The DOM defines a standard for accessing documents like HTML and XML:
"The W3C Document Object Model (DOM) is a platform and language-neutral interface that
allows programs and scripts to dynamically access and update the content, structure, and style of
a document."
The DOM defines the objects and properties of all document elements, and the methods
(interface) to access them.
Explain multi-tagging?
Multi-tagging is a technique used by the DOM browser extension to identify a web page UI
object. Whenever possible, DOM extension inserts more than one tag into the object identifier in
following format:
Browser.BrowserChild(page_title).html_class(caption_tag|window_tag)
1. Caption_tag is the caption of the HTML element.
2. #index_tag is the index of this HTML element, counting from the beginning of this page of the
same class of HTML elements.
3. window_tag is the window identifier.
What is difference between DOM and SAX? What would we use if an option is given?
DOM parses an XML document and returns an instance of org.w3c.dom.Document. This
document object's tree must then
be "walked" in order to process the different elements. DOM parses the ENTIRE Document into
memory, and then makes it
available to you. The size of the Document you can parse is limited to the memory available.