- - Comments

<!- -> Comments

Because XHTML documents are actually XML, they support XML comments, which you can use to annotate your document. These annotations will not be displayed by the browser. XHTML comments are supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1. Comments have no attributes.

We're familiar with comments from XML; you enclose the text in a comment like this: <!--This page was last updated July 3.--> . Using comments, you can describe to readers what's going on in your document.

Here's how I might add comments to an XHTML document:

 <?xml version="1.0"?>  <!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">  <!--    This is the document head    -->  <head>  <!--    This is the document title    -->  <title>             Welcome to my page         </title>     </head>  <!--    This is the document body element    -->  <body>         <h1>  <!--    This is an h1 heading element    -->  Welcome to XHTML!         </h1>     </body> </html> 

As with any XML documents, the comments are supposed to be stripped out by the XML processor that reads the document. On the other hand, keep in mind that comments are text; if you have a lot of them in a lengthy document, you can increase the download time of your document significantly.



Real World XML
Real World XML (2nd Edition)
ISBN: 0735712867
EAN: 2147483647
Year: 2005
Pages: 440
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net