News:

MyKidsDiary.in :: Capture your kids magical moment and create your Online Private Diary for your kids

Main Menu

XHtml Interview Questions And Answers 2

Started by ganeshbala, Apr 01, 2008, 05:45 PM

Previous topic - Next topic

ganeshbala

XHtml Interview Questions And Answers

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.