Results 1 to 2 of 2

Common errors in xhtml

This is a discussion on Common errors in xhtml within the Web Design forums, part of the Web Designing & Development category; hi I m here again for sharing my little ideas with you. hope you like it and give the good ...

  1. #1
    Moderator Array orlando's Avatar
    Join Date
    Sep 2008
    Posts
    111

    Wink Common errors in xhtml

    hi
    I m here again for sharing my little ideas with you. hope you like it and give the good responce. plz post ur views.

    here is some common errors occur in XHTML.
    • 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: [FONT=Courier New, monospace][SIZE=2]<br>[/SIZE][/FONT]
      • Correct: [FONT=Courier New, monospace][SIZE=2]<br />[/SIZE][/FONT]
        Note that any of these are acceptable in XHTML: [FONT=Courier New, monospace][SIZE=2]<br></br>[/SIZE][/FONT], [FONT=Courier New, monospace][SIZE=2]<br/>[/SIZE][/FONT] and [FONT=Courier New, monospace][SIZE=2]<br />[/SIZE][/FONT]. Older HTML-only browsers interpreting it as HTML will generally accept [FONT=Courier New, monospace][SIZE=2]<br>[/SIZE][/FONT] and [FONT=Courier New, monospace][SIZE=2]<br />[/SIZE][/FONT].

    • Not closing non-empty elements

      • Incorrect: [FONT=Courier New, monospace][SIZE=2]<p>This is a paragraph.<p>This is another paragraph.[/SIZE][/FONT]
      • Correct: [FONT=Courier New, monospace][SIZE=2]<p>This is a paragraph.</p><p>This is another paragraph.</p>[/SIZE][/FONT]

    • Improperly nesting elements (Note that this would also be invalid in HTML)

      • Incorrect: [FONT=Courier New, monospace][SIZE=2]<em><strong>This is some text.</em></strong>[/SIZE][/FONT]
      • Correct: [FONT=Courier New, monospace][SIZE=2]<em><strong>This is some text.</strong></em>[/SIZE][/FONT]

    • Not putting quotation marks around attribute values

      • Incorrect: [FONT=Courier New, monospace][SIZE=2]<td rowspan=3>[/SIZE][/FONT]
      • Correct: [FONT=Courier New, monospace][SIZE=2]<td rowspan="3">[/SIZE][/FONT]
      • Correct: [FONT=Courier New, monospace][SIZE=2]<td rowspan='3'>[/SIZE][/FONT]

    • Using the ampersand character outside of entities

      • Incorrect: [FONT=Courier New, monospace][SIZE=2]<title>Cars & Trucks</title>[/SIZE][/FONT]
      • Correct: [FONT=Courier New, monospace][SIZE=2]<title>Cars &amp; Trucks</title>[/SIZE][/FONT]

    • Using the ampersand outside of entities in URLs (Note that this would also be invalid in HTML)

      • Incorrect: [FONT=Courier New, monospace][SIZE=2]<a href="index.php?page=news&style=5">News</a>[/SIZE][/FONT]
      • Correct: [FONT=Courier New, monospace][SIZE=2]<a href="index.php?page=news&amp;style=5">News</a>[/SIZE][/FONT]

    • Failing to recognize that XHTML elements and attributes are case sensitive

      • Incorrect: [FONT=Courier New, monospace][SIZE=2]<BODY><P ID="ONE">The Best Page Ever</P></BODY>[/SIZE][/FONT]
      • Correct: [FONT=Courier New, monospace][SIZE=2]<body><p id="ONE">The Best Page Ever</p></body>[/SIZE][/FONT]

    • Using attribute minimization

      • Incorrect: [FONT=Courier New, monospace][SIZE=2]<textarea readonly>READ-ONLY</textarea>[/SIZE][/FONT]
      • Correct: [FONT=Courier New, monospace][SIZE=2]<textarea readonly="readonly">READ-ONLY</textarea>[/SIZE][/FONT]

    • 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 [FONT=Courier New, monospace][SIZE=2]head[/SIZE][/FONT] element.


    [FONT=Courier New, monospace][SIZE=2]<link rel="stylesheet" href="/style/screen.css" type="text/css" />[/SIZE][/FONT]
    [FONT=Courier New, monospace][SIZE=2]<script type="text/javascript" src="/script/site.js"></script>[/SIZE][/FONT]
    Note: The format [FONT=Courier New, monospace][SIZE=2]<script …></script>[/SIZE][/FONT], rather than the more concise [FONT=Courier New, monospace][SIZE=2]<script … />[/SIZE][/FONT], is required for HTML compatibility when served as MIME type [FONT=Courier New, monospace][SIZE=2]text/html[/SIZE][/FONT].


      • 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 [FONT=Courier New, monospace][SIZE=2]application/xhtml+xml[/SIZE][/FONT] and target only fully conformant browsers, or serve the page as [FONT=Courier New, monospace][SIZE=2]text/html[/SIZE][/FONT] and try to obtain usability in Internet Explorer 6 and other non-conformant browsers.


  2. #2
    Senior Member Array akash's Avatar
    Join Date
    Oct 2008
    Location
    Heaven (Earth)
    Posts
    500

    Default Re: Common errors in xhtml

    Thanks for this useful information.



Similar Threads

  1. Replies: 1
    Last Post: 08-26-2011, 12:47 AM
  2. Replies: 3
    Last Post: 03-19-2011, 10:30 PM
  3. Common misconceptions about database security
    By mayo in forum Member Discussion
    Replies: 0
    Last Post: 05-05-2008, 06:33 PM
  4. Replies: 3
    Last Post: 01-28-2008, 02:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO Forum | Web Hosting Forum | Websites For Sale |