Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Tutorials (http://www.go4expert.com/articles/web-design/)
-   -   Problems occur with XHTML (http://www.go4expert.com/articles/occur-xhtml-t12801/)

Magena 9Aug2008 11:50

Problems occur with XHTML
 
Taken from Wikipedia.

Common errors



Some of the most common errors in the usage of XHTML are:
  • Failing to realize that documents won’t be treated as XHTML unless they are served with an appropriate XML MIME type
  • Not closing empty elements (elements without closing tags in HTML4)
    • Incorrect: <br>
    • Correct: <br />
Note that any of these are acceptable in XHTML: <br></br>, <br/> and <br />. Older HTML-only browsers interpreting it as HTML will generally accept <br> and <br />.
  • Not closing non-empty elements
    • Incorrect: <p>This is a paragraph.<p>This is another paragraph.
    • Correct: <p>This is a paragraph.</p><p>This is another paragraph.</p>
  • Improperly nesting elements (Note that this would also be invalid in HTML)
    • Incorrect: <em><strong>This is some text.</em></strong>
    • Correct: <em><strong>This is some text.</strong></em>
  • Not putting quotation marks around attribute values
    • Incorrect: <td rowspan=3>
    • Correct: <td rowspan="3">
    • Correct: <td rowspan='3'>
  • Using the ampersand character outside of entities
    • Incorrect: <title>Cars & Trucks</title>
    • Correct: <title>Cars &amp; Trucks</title>
  • Using the ampersand outside of entities in URLs (Note that this would also be invalid in HTML)
    • Incorrect: <a href="index.php?page=news&style=5">News</a>
    • Correct: <a href="index.php?page=news&amp;style=5">News</a>
  • Failing to recognize that XHTML elements and attributes are case sensitive
    • Incorrect: <BODY><P ID="ONE">The Best Page Ever</P></BODY>
    • Correct: <body><p id="ONE">The Best Page Ever</p></body>
  • Using attribute minimization
    • Incorrect: <textarea readonly>READ-ONLY</textarea>
    • Correct: <textarea readonly="readonly">READ-ONLY</textarea>
  • Mis-using CDATA, script-comments and xml-comments when embedding scripts and stylesheets.
    • This problem can be avoided altogether by putting all script and stylesheet information into separate files and referring to them as follows in the XHTML head element.
      HTML Code:

      <link rel="stylesheet" href="/style/screen.css" type="text/css" />
       <script type="text/javascript" src="/script/site.js"></script>

      Note: The format <script …></script>, rather than the more concise <script … />, is required for HTML compatibility when served as MIME type text/html.
    • If an author chooses to include script or style data inline within an XHTML document, different approaches are recommended depending whether the author intends to serve the page as application/xhtml+xml and target only fully conformant browsers, or serve the page as text/html and try to obtain usability in Internet Explorer 6 and other non-conformant browsers.

gkumar 3Jul2009 15:22

Re: Problems occur with XHTML
 
For anyone that likes XHTML, there is now evidence to show that XHTML is extremely harmful. According to this report, XHTML has been linked to the following problems:

* Computer viruses;
* Inability to get Opera support;
* Destroying hard drives;
* Automatically forwarding and deleting e-mails; and
* Credit card fraud

Now, if only you had listened before it was too late! :-)

naimish 3Jul2009 15:24

Re: Problems occur with XHTML
 
Yeah Cool one, I have done this using XML Checker ;)

David Michael 6Jul2009 19:18

Re: Problems occur with XHTML
 
where is 404?Its very common due to wrong redirect. . .

Full Zip Hoody 30Sep2010 01:37

Re: Problems occur with XHTML
 
indeed these are the most common errors in the usage of XHTML. But these are all noob errors. For me the most common error is the one when i forget to end the tags. like </p> or </em> very stressful cause i have to come back and reedit


All times are GMT +5.5. The time now is 22:58.