XHTML Interview Questions & Answers part 2

0
274

Q: – Write example that shows every attribute must have a value in XHTML?

Using example I will 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>

Below, I write a same example in XHTML. <ol compact="compact" > <input type="radio" name="title" value="decline" checked="checked">decline</input> In this we assign value compact, checked to element compact and checked.

Q: – Why is this XSLT important?

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.

Q: – Should I use an HTTP GET or POST for my AJAX calls?

AJAX requests should use an HTTP GET request when retrieving data where the data will not change for a given request URL. An HTTP POST should be used when state is updated on the server. This is in line with HTTP idempotency recommendations and is highly recommended for a consistent web application architecture.

Q: – Tell me how to convert an HTML page into XHTML?

If we want to convert HTML pages into XHTML than you have to insert some lines at the starting of document. <?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">

Q: – What are the advantages of XHTML?

Some main advantage of XHTML are given below:
1.In XHTML we can use mixed namespaces.
2.work on XHTML is much simple than HTML.
3.When your document is not well formed than it will immediately informed to you due to an error from your UA in XHTML.

Q: – What the benefits of XHTML are?

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.

Q: – How to build a "Hello World" page. With XHTML ?

"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>

Q: – Attributes values must be in double or single quotes

<ol type=1>
becomes
<ol type="1">
or
<ol type='1'>

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

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

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

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

LEAVE A REPLY