Why is this not valid xhtml?

Discussion in 'HTML & Website Design' started by red-sky, Jan 13, 2009.

  1. #1
    I am trying to verify my xhtml, but I don't understand why it's not valid, I am getting a load of errors (53 errors), even when I believe this is perfectly written code, can someone help point out where im going wrong:

    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
    <html xmlns="http://www.w3.org/1999/xhtml" />
    	<head>
    		<meta name="verify-v1" content="dDvOc0k74sEzmsKdpoU55pHZpvoQH6jUH9L34I6RGxA=" />
    		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    		<link rel="stylesheet" type="text/css" href= "freeiphone.css" />
    		<link rel="shortcut icon" href="http://www.free3giphone.com/free3giphone.ico" />
    		<title>Free iPhone</title>
    
    	</head>
    	<body>
    		<div id="outerWrapper">
    	  		<div id="header">
    	  			<div id="navigation">
    			  		<a href="index.html"><img src="Free-3G-iPhone_homebutton.jpg" border="0" alt="Free iPhone - Home" /></a>
    					<a href="howitworks.html"><img src="Free-3G-iPhone_hiwbutton.jpg" border="0" alt="Free iPhone - How It Works" /></a>
    					<a href="proof.html"><img src="Free-3G-iPhone_proofbutton.jpg" border="0" alt="Free iPhone - Proof!" /></a>
    					<a href="news.html"><img src="Free-3G-iPhone_newsbutton.jpg" border="0" alt="Free iPhone - News" /></a>
    
    					<a href="faq.html"><img src="Free-3G-iPhone_FAQbutton.jpg" border="0" alt="Free iPhone - Frequently Asked Questions" /></a>
    	  			</div>
    	  		</div>
    	  		<div id="contentWrapper">
    	    			<div id="content"><h1>Free iPhone 3G | Claim yours now!</h1>
    					<h2><p align="right">4 Simple Steps to your <b>Free iPhone 3G!&nbsp;&nbsp;&nbsp;</b></p></h2>
    					<p align="center"><object width="339.625" height="275"><param name="movie" value="http://www.youtube.com/v/fPUEzk4mZy4&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/fPUEzk4mZy4&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowfullscreen="true" width="339.625" height="275"></embed></object> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://iphone.giveaway.co.uk/index.php?referral=215867" rel="nofollow" target="_blank" onmouseover="window.status='Destination is here';return true;" ONMOUSEOUT="window.status='Destination is NOT here!';return true;" ><img src="Free-3G-iPhone_steps.jpg" alt="Free 3G iPhone | 4 Simple Steps" border="0" /></a></p>
    
    	        			<hr size="1" />
    	        			<p>Welcome to Free3GiPhone! I have created this website to spread the word of where YOU can get yourself a <a href="http://iphone.giveaway.co.uk/index.php?referral=215867" rel="nofollow" target="_blank"><b>FREE iPhone 3G</b></a>! I am a private individual like you, and thus, struggle to find the spare money to buy much wanted expensive electrical goods i.e. such as the Apple iPhone 3G! </p>
    	        			<p>Whilst browsing the internet, I came across an advertisement offering a <b>FREE iPhone</b>, I had seen so many of these ads that I decided to finally give it a go and 2 weeks later I received my <b>FREE iPhone</b>! You can check it out in the video above or in the <a href="proof.html" >Proof section</a>.</p>
    					<h2>&quot;...How can they afford to giveaway a FREE iPhone?&quot;</h2>
    
    	        			<hr size="1" />
    	        			<p>I highly recommend reading the <a href="howitworks.html"  rel="nofollow"><b>How It Works</b></a> section to understand how you are able to receive your <b>FREE iPhone</b>, it has a detailed description of how the Giveaway websites are able to send you these Apple iPhone 3G's for FREE and it only takes about 1 minute to read! </p>
    	        			<h2>&quot;...Is this for Real?&quot; </h2>
    	        			<hr size="1" />
    
    	        			<p>If your still finding it hard to believe, you can go to the <a href="proof.html"  rel="nofollow">Proof section</a> and see other gifts that I have received for FREE since receiving my <b>FREE iPhone</b> from the Giveaway website. </p>
    					<hr size="1" />
    					<center><h2>Finally..Get your FREE iPhone 3G!</h2></center>
    					<p><center><a href="http://iphone.giveaway.co.uk/index.php?referral=215867" rel="nofollow" target="_blank"><img src="Free-3G-iPhone_iphonebutton.jpg" border="0" /></a></center></p>
    	    			</div>
    
    	  		</div>
    		  	<div id="footer">
    		  		Free3GiPhone &copy; Claim your <b><u>FREE iPhone</u></b>!
    		  	</div>
    		</div>
    	</body>
    </html>
    Code (markup):
    The website address is www.free3giphone.com/index.html and some of the rare errors im getting that I can't solve are:

    1 Line : 4 column 1 : Warning: <html> isn't allowed in <head> elements line
    <html xmlns="http://www.w3.org/1999/xhtml" />
    2 Line : 4 column 1 : Warning: discarding unexpected <html> line
    <html xmlns="http://www.w3.org/1999/xhtml" />
    3 Line : 5 column 9 : Warning: <head> isn't allowed in <body> elements line
    <head>
    4 Line : 5 column 9 : Warning: <meta> isn't allowed in <body> elements line
    <head>
    5 Line : 5 column 9 : Warning: <meta> isn't allowed in <body> elements line
    <head>
    6 Line : 5 column 9 : Warning: <link> isn't allowed in <body> elements line
    <head>
    7 Line : 5 column 9 : Warning: <link> isn't allowed in <body> elements line
    <head>
    8 Line : 5 column 9 : Warning: <title> isn't allowed in <body> elements line
    <head>
    9 Line : 5 column 9 : Warning: </head> isn't allowed in <body> elements line
    <head>
    10 Line : 12 column 9 : Warning: discarding unexpected <body> line
    <body>

    Any help on this would be greatly appreciated, I will be happy to +rep anybody who can help :)
     
    red-sky, Jan 13, 2009 IP
  2. Guthix121

    Guthix121 Well-Known Member

    Messages:
    1,078
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    105
    #2
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
    <html xmlns="http://www.w3.org/1999/xhtml" />
    
    Code (markup):
    Change that to
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    Code (markup):
    After that, it will give you a bunch of normal xHTML errors, and you can fix it from there :)
     
    Guthix121, Jan 13, 2009 IP
  3. red-sky

    red-sky Peon

    Messages:
    89
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your reply, thats actually what i had before until i seen what i have now on a different website. I have changed it back now but it still gives really rare errors i.e.:

    4 Line : 26 column 165 : Warning: unescaped & or unknown entity "&fs" line

    <p align="center"><object width="339.625" height="275"><param name="movie" value="http://www.youtube.com/v/fPUEzk4mZy4&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/fPUEzk4mZy4&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowfullscreen="true" width="339.625" height="275"></embed></object> <a href="http://apple.freebiejeebies.co.uk/7226itemid45" rel="nofollow" target="_blank" ><img src="Free-3G-iPhone_steps.jpg" alt="Free 3G iPhone | 4 Simple Steps" border="0" /></a></p>

    5 Line : 26 column 170 : Warning: unescaped & or unknown entity "&rel" line

    <p align="center"><object width="339.625" height="275"><param name="movie" value="http://www.youtube.com/v/fPUEzk4mZy4&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/fPUEzk4mZy4&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowfullscreen="true" width="339.625" height="275"></embed></object> <a href="http://apple.freebiejeebies.co.uk/7226itemid45" rel="nofollow" target="_blank" ><img src="Free-3G-iPhone_steps.jpg" alt="Free 3G iPhone | 4 Simple Steps" border="0" /></a></p>
    6 Line : 26 column 176 : Warning: unescaped & or unknown entity "&color
    <p align="center"><object width="339.625" height="275"><param name="movie" value="http://www.youtube.com/v/fPUEzk4mZy4&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/fPUEzk4mZy4&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowfullscreen="true" width="339.625" height="275"></embed></object> <a href="http://apple.freebiejeebies.co.uk/7226itemid45" rel="nofollow" target="_blank" ><img src="Free-3G-iPhone_steps.jpg" alt="Free 3G iPhone | 4 Simple Steps" border="0" /></a></p>
    7 Line : 1" line 26 column 192 : Warning: unescaped & or unknown entity "&color

    Any ideas? This is a nightmare lol
     
    red-sky, Jan 13, 2009 IP
  4. MelogKnaj

    MelogKnaj Active Member

    Messages:
    233
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Take the error line it gives you and google it. That will give you multiple sites that show you how to fix it.
     
    MelogKnaj, Jan 13, 2009 IP
  5. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #5
    & is not allowed unescaped -- change all instances to &amp;

    JFP
     
    jamesicus, Jan 13, 2009 IP
  6. gnp

    gnp Peon

    Messages:
    137
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi red-sky..

    parts like
    <param name="movie" value="http://www.youtube.com/v/fPUEzk4mZy4&hl=en&fs=1&rel=....
    Code (markup):
    are causing the problems..

    The problem is that value is an attribute of the param tag.
    Now in xhtml the & char cannot be used in attribute values. it needs to be html encoded .. so it should be &amp;
    to validate as xhtml, that should be
    value="http://www.youtube.com/v/fPUEzk4mZy4&amp;hl=en&amp;fs=1&amp;rel=....
    Code (markup):
    but i am not sure if it would load the flash :D (you should better try loading the flash through

    Additionally, while object tag is part of the XHTML specification the embed tag is not.. so that will be another problem down the road..

    take a look at this post for more info www.alistapart.com/articles/flashsatay/ (i am not allowed live links yet..)

    take care
     
    gnp, Jan 13, 2009 IP