Q) 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.
Q) 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.
Q) 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.
Q) 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.
Q) What is XHTML validation?
XHTML validation is a process used to validate XHTML documents with W3C’s validator.
Q) 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.
Q) Can elements be overlapped in XHTML or not?
In XHTML elements cannot be overlapped.
Q) 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:
<ol compact> <input type="radio" name="title" value="decline" checked>decline</input>
Same example in XHTML:
<ol compact="compact" > <input type="radio" name="title" value="decline" checked="checked">decline</input> </p>
Q) What is XHTML Modularization?
The decomposition of XHTML into a group of modules that are abstract to provide modularity is known as XHTML Modularization.
Q) What is the use of XHTML Modules?
The XHTML modules are utilized in the XML document type definition language.
Q) 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.
Q) 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.
Q) How to create a Hello World page in XHTML?
The Hello World page of XHTML 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>
Q) 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.
Q) 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.