Javatpoint Logo
Javatpoint Logo
XHTML Interview Questions

XHTML Interview Questions

1) What is XHTML?

XHTML stands for Extensible Hypertext Markup Language. It is a combination of XML and HTML. It is a more formal and stricter version of HTML.

2) Why to use XHTML?

XHTML is more formal and stricter version of HTML. i.e.

  • It has properly nested elements.
  • All XHTML elements must always be closed.
  • All XHTML elements must be written in lower case.
  • Every XHTML document must have one root element.

That is the reason behind its preferences over HTML because; most of the web pages contain bad HTML.


3) What is the difference between XHTML and HTML?

There are some changes in XHTML as compared to HTML:

  • All documents must have a DOCTYPE.
  • The xmlns attribute in <html> is mandatory and must specify the xml namespace for the document.
  • <html>, <head>, <title>, and <body> are mandatory with their respective closing tags.
  • All XHTML tags must be in lower case.
  • All XHTML tags must be closed.
  • All XHTML tags must be properly nested.
  • The XHTML documents must have one root element.
  • All XHTML attributes must be added properly.
  • All XHTML attributes must be in lower case.
  • The name attribute has changed.
  • XHTML attributes cannot be shortened.
  • XHTML attribute values must be quoted.

4) How is XHTML better than HTML?

Following are the reasons specifying why XHTML 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 makes easy the integration of new elements as subsets of SGML.

5) What is XHTML validation?

XHTML validation is a process used to validate XHTML documents with W3C's validator.


6) Is it difficult to write codes in XHTML rather than HTML?

XHTML is not very different from HTML 4.01, so you can easily adopt it. You should start to write your HTML code in lowercase letters.


7) Can elements be overlapped in XHTML or not?

In XHTML elements cannot be overlapped.


8) Write an example that shows every attribute must have a value in XHTML?

Let's take an example to show you in XHTML every attribute must have a value.

Example in HTML:

Same example in XHTML:


9) What is XHTML Modularization?

The decomposition of XHTML into a group of modules that are abstract to provide modularity is known as XHTML Modularization.


10) What is the use of XHTML Modules?

The XHTML modules are utilized in the XML document type definition language.


11) Why to use XHTML Modularization?

XHTML modularization specifies a well defined set of XHTML elements which can be compiled and extended. It supports a specific devise by using standard building blocks and standard methods for building blocks usage.


12) How can you define DTD in XHTML?

There are three types of DTD used in XHTML.

  • Strict DTD
  • Transitional DTD
  • Frameset DTD

You can use any of the DTD on the top of the XHTML document.


13) How to create a Hello World page in XHTML?

The Hello World page of XHTML looks like this:


14) What is the need of modular DTDs?

Modular DTD makes it easy to deploy new deployments. An application only supports subset of XHTML. For example a mobile phone, Internet TV etc. only require a subset of XHTML.


15) What is DOM?

DOM is a platform independent, World Wide Web Consortium (W3C) standard form of representation of structured documents as an object-oriented model. It is an application programming interface for accessing HTML and XML documents.




Please Share

facebook twitter google plus pinterest tumbler

Learn Latest Tutorials