• +91 9971497814
  • info@interviewmaterial.com

XHTML Interview Questions Answers

XHTML Interview Questions Answers

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

Answer - 1 : - * 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 - 2 : - What's XHTML Validation?

Answer - 2 : - 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 - 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 : - Why is this XSLT important?

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

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 XHTML Modularization?

Answer - 6 : - 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 - 7 : - Why Code Your Own XHTML?

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

Question - 8 : - What about conversion of existing HTML pages - especially bulk conversion, as I have many thousands of HTML files?

Answer - 8 : - W3C has written a utility program called Tidy which can be used to convert HTML pages to XHTML. Tidy can be used in batch mode to bulk-convert documents. Tidy is an open source program, which has been incorporated into an number of authoring tools, most notably HTML-Kit

Question - 9 : - Differences between XML and HTML

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

Question - 10 : - What the benefits of XHTML are?

Answer - 10 : - 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>

XHTML Contributors

krishan

Share your email for latest updates

Name:
Email:

Our partners