- The first 3 lines of every PHP document should always be the following XML declaration:
<?php
echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
?>
- No white space (i.e.: No spaces, No line breaks) before this tag.
- Note: Because PHP delimiters begin with <? and the XML declaration also begins with <? that we have to use a PHP echo statement in order to write out the XML declaration to the file.
- The next line of each document should use the XHTML Strict DTD for the
<!doctype> tag.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- We will use the strict DTD for the whole semester.
- The next line of code should be the opening <html> tag. The <html> tag in every document should always be:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- xmlns specifies the XML namespace for a document.
- xml:lang specifies the contents and attributes as English and is a required accessibility standard.
- lang specifies the content of a tag as English and is a required accessibility standard.
- At the top of every XHTML file, between the <head> and </head>
tags, place your name, the date, and the exercise number in html comments
like this so that they stand out in the document and can be readily found.
(The following code is XRay XML Editor friendly - copy and paste instead of re-typing - there are spaces between the dashes):
<!-- - - - - - - - - - - - - -->
<!-- Your O. Name -->
<!-- February 31, 2016 -->
<!-- Exercise #__ -->
<!-- - - - - - - - - - - - - -->
- At the top of every XHTML file, between the <head> and </head> tags, place a <meta> tag as shown below:
<meta http-equiv="content-type" content="text/html; UTF-8" />
- Without this line of code, you will receive an accessibility warning.
- The encoding type (UTF-8) should match the encoding in the XML declaration above.
- All pages should conform to the wellformedness constraints of XML (and XHTML).