• +91 9971497814
  • info@interviewmaterial.com

XHTML Interview Questions Answers

Question 1 : Why XHTML Modularization?

Answer 1 : 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).

Question 2 : How to build a "Hello World" page. With XHTML ?

Answer 2 : "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>

Question 3 : What's the advantages of XHTML?

Answer 3 : * Mixed namespaces * Much simpler to work with (for programs, at least) than HTML * You will immediately know when your document is not well-formed due to an error from your UA.

Question 4 : How is XHTML better than HTML? Why would you want to use XHTML?

Answer 4 : * 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.

Question 5 : What is XHTML?

Answer 5 : 1  XHTML is a more formal, stricter version of HTML. XHTML is defined by an XML dtd which makes it much easier to handle. 2.  * XHTML stands for eXtensible Hyper Text Markup Language. * It is aimed to replace HTML. * It is almost identical to HTML 4.01 * It is the reformulation of HTML 4.01 as an application of XML. * It is a stricter, tidier version of HTML. XHTML 1.0 is the next level of coding as specified by the W3C. XHTML is a transition / combination of HTML and XML. To change from HTML to XHTML requires just a few changes in your coding styles. The main page to check out is CONVERTING but all the others provide valuable information about this coding technique as well. XHTML provides the framework for future extensions of HTML and aims to replace HTML in the future. Some resources refer to XHTML as HTML5. XHTML 1.0 became an official W3C recommendation on January 26, 2000. A W3C recommendation means that the specification is stable, that it has been reviewed by the W3C membership, and that the specification is now a Web standard. XHTML 1.0 is the first step toward a modular and extensible web environment based on XML (eXtensible Markup Language). It provides the bridge for web designers to use a future based coding and still be able to maintain compatibility with today's browsers. XHTML is a stricter and cleaner version of HTML. 3.   * XHTML stands for EXtensible HyperText Markup Language * XHTML is aimed to replace HTML * XHTML is almost identical to HTML 4.01 * XHTML is a stricter and cleaner version of HTML * XHTML is HTML defined as an XML application * XHTML is a W3C Recommendation XHTML is a combination of HTML and XML (EXtensible Markup Language). XHTML consists of all the elements in HTML 4.01 combined with the syntax of XML. Advantages of using XHTML instead of HTML 1. Documents can be validated much easier 2. Documents can be transformed via tools like XSLT into other documents for consumption by devices like handhelds 3. Fragments of documents can be retrieved faster 4. Text can be stored more effieciently in object oriented databases Answer4: The great thing about XHTML, though, is that it is almost the same as HTML

Question 6 : Why do we need modular DTDs?

Answer 6 : 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.

Question 7 : What's XHTML Validation?

Answer 7 : An XHTML document is validated against a Document Type Definition. Validate XHTML With A DTD An XHTML document is validated against a Document Type Definition (DTD). Before an XHTML file can be properly validated, a correct DTD must be added as the first line of the file. The Strict DTD includes elements and attributes that have not been deprecated or do not appear in framesets: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" The Transitional DTD includes everything in the strict DTD plus deprecated elements and attributes: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" The Frameset DTD includes everything in the transitional DTD plus frames as well: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" This is a simple XHTML document: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>simple document</title> </head> <body> <p>a simple paragraph</p> </body> </html> Ampersands in hrefs must convert "&" to "&amp;" in the URI <a href="http://www.phonelists.com/cgi-bin/Handler.pl?ListID=Test&Password=test&action=View">Sample List</a> becomes <a href="http://www.phonelists.com/cgi-bin/Handler.pl?ListID=Test&Password=test&action=View">Sample List</a> # The attribute "name" becomes "id" when used for a locator inside a document For example, to reference a section within a document with a URI, we usually do something like "<a href="favoriteA

Question 8 : What the benefits of XHTML are?

Answer 8 : As XHTML is an XML application, you will benefit from developments in the XML world. For example XML tools such as editors, converters, browsers, etc. can be used with XHTML resources. In addition there are developments to the XML family of protocols and formats which will provide additional functionality for XHTML. Attributes values must be in double or single quotes <ol type=1> becomes <ol type="1"> or <ol type='1'> Every element must have an end tag, even when it doesn't really matter. <br> <input type="text" value="Amazon.com" size="20" > becomes <br /> <input type="text" value="Amazon.com" size="20" /> For compatibility with older browsers its best to put a single space before the '/'. Some browsers have trouble with "<br></br>" so its best to use "<br />" How to convert most HTML pages to XHTML. 1. Heading lines at top At the beginning of documents we need to include a few lines: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> The location of the dtd allows validating parsers to check the document. Most browsers will ignore these tags. Every attribute must have a value <ol compact> <input type="radio" name="title" value="decline" checked>decline</input> becomes <ol compact="compact" > <input type="radio" name="title" value="decline" checked="checked">decline</input>

Question 9 : What the benefits of XHTML are?

Answer 9 : As XHTML is an XML application, you will benefit from developments in the XML world. For example XML tools such as editors, converters, browsers, etc. can be used with XHTML resources. In addition there are developments to the XML family of protocols and formats which will provide additional functionality for XHTML. Attributes values must be in double or single quotes <ol type=1> becomes <ol type="1"> or <ol type='1'> Every element must have an end tag, even when it doesn't really matter. <br> <input type="text" value="Amazon.com" size="20" > becomes <br /> <input type="text" value="Amazon.com" size="20" /> For compatibility with older browsers its best to put a single space before the '/'. Some browsers have trouble with "<br></br>" so its best to use "<br />" How to convert most HTML pages to XHTML. 1. Heading lines at top At the beginning of documents we need to include a few lines: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> The location of the dtd allows validating parsers to check the document. Most browsers will ignore these tags. Every attribute must have a value <ol compact> <input type="radio" name="title" value="decline" checked>decline</input> becomes <ol compact="compact" > <input type="radio" name="title" value="decline" checked="checked">decline</input>

Question 10 : Why to type a tags in uppercase, and never bother closing the paragraphs ?

Answer 10 : For reasons on internationalisation XML elements are case sensitive. A choice had to be made, and lowercase won on the day. Tags may not overlap This is <em> emphasized text and <b>bold </em>text</b> becomes This is <em>emphasized text </em> is <b>bold text</b> Only certain tags may nest inside other tags Looking at the dtd for xhtml, the definition of the "ol" element is: <!ELEMENT ol (li)+> <!ATTLIST ol %attrs; type %OLStyle; #IMPLIED compact (compact) #IMPLIED start %Number; #IMPLIED > This implies that an order list, "ol", element may not contain paragraph tags or body text, just list items. <ol> These are some of my favorite animals: <li>octopus</li> <li>shrew</li> <li>lemur</li> and my most favorite <li>meerkats</li> </ol> becomes <p>These are some of my favorite animals:</p> <ol> <li>octopus</li> <li>shrew</li> <li>lemur</li> <li>meerkats</li> </ol>  

XHTML Contributors

krishan

Share your email for latest updates

Name:
Email:

Our partners