XHTML Interview Questions & Answers part 1

0
343

Q: – What is XHTML? Why XHTML?

XHTML stands for Extensible Hypertext Markup Language. It is a combination of XML and HTML capabilities. XHTML can be viewed as intersection of HTML and XML in many aspects.

Why to use XHTML:

Most of the web pages contain bad HTML
Combines the strengths of both XML and HTML
XHTML is strict in defining the tags, like
Properly nested elements
All elements must always be closed
All elements must be written in lower case
Every XHTML document must have one root element.

Q: – 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.

Q: – How is XHTML better than HTML?

The following are the reasons for why XTML is better than HTML:

  • XHTML uses style sheets instead of font, color and alignment tags of HTML.
  • XHTML allows to style sheets and scripts embedding in CDATA section.
  • XML of XHTML eases the integration of new elements as subsets of SGML.
  • Portable – Non-pc platforms can be accessed with XHTML.

Q: – 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

Q: – What is XHTML Modularization? Why XHTML Modularization?

The decomposition of XHTML and by reference HTML into a group of modules that are abstract to provide modularity is known as XHTML modularization. These modules are utilized in the XML document type definition language. The rules needed to define the abstract model uses XML DTD.

Modularization of XHTML refers to specify well defined set of XHTML elements which can be compiled and extended by the XHTML document developers, other XML standards specifications.

Modularization of XTML acts as a means for the designers of product for specifying the elements that supports a specific devise by using standard building blocks and standard methods for building blocks usage. The content community gets “points of conformance” by using these modules.

Q: – What is XHTML Validation?

XHTML validation is the process of validating XHTML document with w3c’s validator.

Q: – 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.

Q: – Is is right only certain tags may nest inside other tags in XHTML?

Yes, In XHTML we can insert only certain tags inside other tags. Example:
<ol> Some my favorite flowers are:
<li>lotus</li>
<li>lilly</li>
<li>sunflower</li>
and my most favorite flower is:
<li>red rose</li> </ol>
In the above example we insert the paragraph between
<li> tag.It's wrong. In case of XHTML our example looks like that, becomes <p>
Some my favorite flowers are:</p> <ol>
<li>lotus</li>
<li>lilly</li>
<li>sunflower</li>
<li>red rose</li>
</ol>

Q: – 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.

Q: – In XHTML tags may overlap or not?

In XHTML tags may not be overlapped.

Example: <em> emphasized text and <b>bold </em>text</b> We can use above example in XHTML like that, <em>emphasized text </em> is <b>bold text</b>

Submitted By:– Nitu Chabra            Email-ID: – nituchabra@mail.com

SHARE

LEAVE A REPLY