...

View Full Version : document type does not allow element "foo" here



yinyang107
02-13-2011, 09:33 PM
I get this error several times when using the w3 validator, but I'm not sure why. Here is my code up to the first occurrence of the error:
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="author" content="Eric Kemp" />
<title>xHTML Table Examples - INT222 Assignment 1 - Eric Kemp</title>
</head>

<body>
<a id="top"></a>
<table border="0" width="100%" cellpadding="10">
<tr>
<td bgcolor="#FFFFFF" width="200" height="50" align="center" valign="bottom">
<img src="images/scslogo.png" alt="SCS Logo" title="SCS Logo"/>
</td>
<th bgcolor="#FFFFFF" width="*" valign="middle">
xHTML Table Examples
</th>
</tr>

<tr>
<td bgcolor="#FFFFFF" align="center" valign="top">
<hr/><a href="index.html"> <img src="images/home.png" alt="Assignment 1 Home Page" title="Assignment 1 Home Page" border="0"/> </a>
<hr/><a href="resume.html"> <img src="images/resume.png" alt="My Resume" title="My Resume" border="0"/> </a>
<hr/><a href="research.html"> <img src="images/research.png" alt="My Research" title="My Research" border="0"/> </a>
<hr/><a href="tables.html"> <img src="images/tables.png" alt="xHTML Table Examples" title="xHTML Table Examples" border="0"/> </a>
<hr/><a href="lists.html"> <img src="images/lists.png" alt="xHTML List Examples" title="xHTML List Examples" border="0"/> </a>
<hr/><a href="contact.html"> <img src="images/contact.png" alt="Contact Me" title="Contact Me" border="0"/> </a>
<hr/><a href="honesty.html"> <img src="images/honesty.png" alt="Honesty Policy" title="Honesty Policy" border="0"/> </a>
<hr/><a href="../index.html"> <img src="images/zenit.png" alt="My Zenit Account" title="My Zenit Account" border="0"/> </a>
<hr/>
</td>
<td bgcolor="#CCCCCC" align="center">
<p>
Jump to:<br/>
<a href="#x1">[Example 1]</a> <a href="#x2">[Example 2]</a> <a href="#x3">[Example 3]</a>
<a href="#x4">[Example 4]</a> <a href="#x5">[Example 5]</a><hr/>

The error says the last <hr/> is invalid. What's going on here?

yinyang107
02-13-2011, 09:38 PM
Here's the full code:
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="author" content="Eric Kemp" />
<title>xHTML Table Examples - INT222 Assignment 1 - Eric Kemp</title>
</head>

<body>
<a id="top"></a>
<table border="0" width="100%" cellpadding="10">
<tr>
<td bgcolor="#FFFFFF" width="200" height="50" align="center" valign="bottom">
<img src="images/scslogo.png" alt="SCS Logo" title="SCS Logo"/>
</td>
<th bgcolor="#FFFFFF" width="*" valign="middle">
xHTML Table Examples
</th>
</tr>

<tr>
<td bgcolor="#FFFFFF" align="center" valign="top">
<br/>-----<br/><a href="index.html"> <img src="images/home.png" alt="Assignment 1 Home Page" title="Assignment 1 Home Page" border="0"/> </a>
<br/>-----<br/><a href="resume.html"> <img src="images/resume.png" alt="My Resume" title="My Resume" border="0"/> </a>
<br/>-----<br/><a href="research.html"> <img src="images/research.png" alt="My Research" title="My Research" border="0"/> </a>
<br/>-----<br/><a href="tables.html"> <img src="images/tables.png" alt="xHTML Table Examples" title="xHTML Table Examples" border="0"/> </a>
<br/>-----<br/><a href="lists.html"> <img src="images/lists.png" alt="xHTML List Examples" title="xHTML List Examples" border="0"/> </a>
<br/>-----<br/><a href="contact.html"> <img src="images/contact.png" alt="Contact Me" title="Contact Me" border="0"/> </a>
<br/>-----<br/><a href="honesty.html"> <img src="images/honesty.png" alt="Honesty Policy" title="Honesty Policy" border="0"/> </a>
<br/>-----<br/><a href="../index.html"> <img src="images/zenit.png" alt="My Zenit Account" title="My Zenit Account" border="0"/> </a>
<br/>-----<br/>
</td>
<td bgcolor="#CCCCCC" align="center">
<p>
Jump to:<br/>
<a href="#x1">[Example 1]</a> <a href="#x2">[Example 2]</a> <a href="#x3">[Example 3]</a>
<a href="#x4">[Example 4]</a> <a href="#x5">[Example 5]</a><br/>-----<br/>

<a id="x1">Example 1</a><br/>
<table width='80%' cellpadding="10" cellspacing="10" align="left" border="10" bgcolor="#FFFFCC">
<tr><th>Attribute</th><th>Values</th></tr>
<tr><td>Width</td><td><i>Pixels<br/>Percentage</i>%</td></tr>
<tr><td>Cellpadding</td><td><i>Pixels</i></td></tr>
<tr><td>Cellspacing</td><td><i>Pixels</i></td></tr>
<tr><td>Align</td><td>"Left"<br/>"Center"<br/>"Right"</td></tr>
<tr><td>Border</td><td><i>Pixels</i></td></tr>
<tr><td>BGColor</td><td>RGB(<i>r,g,b</i>)<br/>#<i>rrggbb<br/>colorname</i></td></tr>
</table>
<a href="#top">[top]</a>
<br/><br/>-----<br/>

<a id="x2">Example 2</a><br/>
<table border="1" bgcolor="#FFFFFF">
<tr valign="middle">
<th width="100">Time</th>
<th width="200">Wednesday</th>
<th width="200">Thursday</th>
<th width="200">Friday</th>
</tr>
<tr valign="middle">
<td align="center">10:45 - 11:30</td>
<td align="center">Censorship</td>
<td align="center"> </td>
<td align="center">O.O.P.</td>
</tr>
<tr valign="middle">
<td align="center">11:40 - 12:25</td>
<td align="center" rowspan="4"> </td>
<td align="center" rowspan="2" colspan="2">Business Computing</td>
</tr>
<tr valign="middle">
<td align="center">12:35 - 1:20</td>
</tr>
<tr valign="middle">
<td align="center">1:30 - 2:15</td>
<td align="center" rowspan="2">Internet Basics</td>
<td align="center" rowspan="2">SQL Databases</td>
</tr>
<tr>
<td align="center">2:25 - 3:10</td>
</tr>
</table>
<a href="#top">[top]</a>
<br/>-----<br/>

<a id="x3">Example 3</a><br/>
<table bgcolor="#FFFFFF">
<tr><td align="center">
<table bgcolor="#CCCCCC" border="1"><caption align="top">Top NHL Player</caption>
<tr><td>Name</td><td>Steven Stamkos</td></tr>
<tr><td>Team</td><td>Tampa Bay Lightning</td></tr>
</table>
<br/>
<table bgcolor="#CCCCCC" border="1"><caption align="bottom">Stats</caption>
<tr><td>Goals</td><td>40</td></tr>
<tr><td>Assists</td><td>34</td></tr>
<tr><td>Games Played</td><td>56</td></tr>
</table>

</td></tr>
</table>
<a href="#top">[top]</a>
<br/>-----<br/>

<a id="x4">Example 4</a><br/>
<table bgcolor="#FFFFFF">
<tr><td align="center">
<img src="images/scslogo.png" alt="SCS Logo"/><br/>
Eric Kemp<br/>
eckemp@learn.senecac.on.ca
</td></tr>
</table>
<a href="#top">[top]</a>
<br/>-----<br/>

<a id="x5">Example 5</a><br/>
<table bgcolor="#FFFFFF" border="1">
<tr valign="top" height="50">
<td align="left" width="75">INT222</td>
<td align="center" width="75">INT222</td>
<td align="right" width="75">INT222</td>
</tr>
<tr valign="middle" height="50">
<td align="left" width="75">INT222</td>
<td align="center" width="75">INT222</td>
<td align="right" width="75">INT222</td>
</tr>
<tr valign="bottom" height="50">
<td align="left" width="75">INT222</td>
<td align="center" width="75">INT222</td>
<td align="right" width="75">INT222</td>
</tr>
</table>
<a href="#top">[top]</a>
<br/>-----<br/>

</p>
</td>
</tr>

<tr>
<td></td>
<td bgcolor="#CCCCCC" align="center">
<script type='text/javascript'>
//<![CDATA[

document.write ("<a href='http://validator.w3.org/check?uri=" +
location.href+ "\;ss=1;verbose=1' target='display'>" +
"<img src='https://cs.senecac.on.ca/~int222/images/valid-xhtml10.png' " +
"width='60' height='21' border='0' " +
"alt='Valid XHTML 1.0 Transitional.' title='Valid XHTML 1.0 Transitional.' /></a>")

dt=new Date(document.lastModified); // Get document last modified date
document.write("<small>This page was last modified on "+dt.toLocaleString()+"</small>")

//]]>
</script>
</td>
</tr>
</table>
</body>
</html>

Jimather
02-13-2011, 09:41 PM
It means exactly that.

You cannot put a horizontal rule inside a table element.

You should not be using tables for your layout anyway. You should be using divs and setting their properties with a style sheet.

yinyang107
02-13-2011, 09:42 PM
Not allowed, this is a school assignment. I guess I'll replace them with <br/>-----<br/> then.

EDIT: How about "does not allow table", then? The first of these is line 42:
<table width='80%' cellpadding="10" cellspacing="10" align="left" border="10" bgcolor="#FFFFCC">

EDIT 2: Wait, how come it doesn't protest on my template, and only on the very last hr in my first post?

template.html:
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="author" content="Eric Kemp" />
<title>NAME GOES HERE - INT222 Assignment 1 - Eric Kemp</title>
</head>

<body>
<table border="0" width="100%" cellpadding="10">
<tr>
<td bgcolor="#FFFFFF" width="200" height="50" align="center" valign="bottom">
<img src="images/scslogo.png" alt="SCS Logo" title="SCS Logo"/>
</td>
<th bgcolor="#FFFFFF" width="*" valign="middle">
NAME GOES HERE
</th>
</tr>

<tr>
<td bgcolor="#FFFFFF" align="center" valign="top">
<hr/><a href="index.html"> <img src="images/home.png" alt="Assignment 1 Home Page" title="Assignment 1 Home Page" border="0"/> </a>
<hr/><a href="resume.html"> <img src="images/resume.png" alt="My Resume" title="My Resume" border="0"/> </a>
<hr/><a href="research.html"> <img src="images/research.png" alt="My Research" title="My Research" border="0"/> </a>
<hr/><a href="tables.html"> <img src="images/tables.png" alt="xHTML Table Examples" title="xHTML Table Examples" border="0"/> </a>
<hr/><a href="lists.html"> <img src="images/lists.png" alt="xHTML List Examples" title="xHTML List Examples" border="0"/> </a>
<hr/><a href="contact.html"> <img src="images/contact.png" alt="Contact Me" title="Contact Me" border="0"/> </a>
<hr/><a href="honesty.html"> <img src="images/honesty.png" alt="Honesty Policy" title="Honesty Policy" border="0"/> </a>
<hr/><a href="../index.html"> <img src="images/zenit.png" alt="My Zenit Account" title="My Zenit Account" border="0"/> </a>
<hr/>
</td>
<td bgcolor="#CCCCCC" align="center">
CONTENT GOES HERE
</td>
</tr>

<tr>
<td></td>
<td bgcolor="#CCCCCC" align="center">
<script type='text/javascript'>
//<![CDATA[

document.write ("<a href='http://validator.w3.org/check?uri=" +
location.href+ "\;ss=1;verbose=1' target='display'>" +
"<img src='https://cs.senecac.on.ca/~int222/images/valid-xhtml10.png' " +
"width='60' height='21' border='0' " +
"alt='Valid XHTML 1.0 Transitional.' title='Valid XHTML 1.0 Transitional.' /></a>")

dt=new Date(document.lastModified); // Get document last modified date
document.write("<small>This page was last modified on "+dt.toLocaleString()+"</small>")

//]]>
</script>
</td>
</tr>
</table>
</body>
</html>

yinyang107
02-13-2011, 10:25 PM
Bump, just in case people don't realize this isn't resolved.

yinyang107
02-13-2011, 10:59 PM
Anyone? Why do I get "document type does not allow element "table" here"?

VIPStephan
02-13-2011, 11:10 PM
I don’t get an error when I paste your last code into the direct input field of the W3C validator.

yinyang107
02-13-2011, 11:17 PM
I posted the wrong code in my second post:o It's fixed now.

yinyang107
02-14-2011, 12:08 AM
Bump again.

venegal
02-14-2011, 12:19 AM
You must not put any block level elements (in this case <table>) into a <p> element.

Also, please read the forum guidelines, and don't repeatedly bump your thread.

yinyang107
02-14-2011, 02:26 AM
Thanks, and sorry. It's due tonight, so I was impatient.

teedoff
02-14-2011, 02:51 AM
lol maybe you should start school work well before its due? just a thought.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum