DEVFYI - Developer Resource - FYI

How to convert most HTML pages to XHTML.

XHTML Interview Questions and Answers


(Continued from previous question...)

24. 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.

(Continued on next question...)

Other Interview Questions