Jump to content

Help me validate my XHTML


Jammy_Stuff

Recommended Posts

Okay so I'm making my first website and I've come to a problem when validating. I have three html files on my site so far. One is index.html which contains two frames and navigation.html and home.html which open in the frames.When I validate http://www.james-wheatley.co.uk/index.html using validator.w3.org, I get a tentative pass with this error:

No Character Encoding Found! Falling back to UTF-8.    I was not able to extract a character encoding labeling from any of the valid sources for such information. Without encoding information it is impossible to reliably validate the document. I'm falling back to the "UTF-8" encoding and will attempt to perform the validation, but this is likely to fail for all non-trivial documents.    Read the FAQ entry on character encoding for more details and pointers on how to fix this problem with your document.
I get that error with all three files.With navigation.html and home.html, I get failures due to these two errors:
Error  Line 7 column 5: document type does not allow element "body" here.<body>The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
and
Error  Line 10 column 6: end tag for "html" which is not finished.</html>Most likely, You nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, <head> generally requires a <title>, lists (ul, ol, dl) require list items (li, or dt, dd), and so on.
Can anybody lend me a hand as it's got me stumped.
Link to comment
Share on other sites

Thanks. That sorted out the encoding error. Seeing as I'm getting the same errors in both I'll post up the current code of the navigation.html file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"><html><head><title>Welcome to James' site</title><link rel="stylesheet" type="text/css" href="navigation.css" /><meta http-equiv="content-type" content="text/html; charset=utf-8" /></head><body><a href="home.html" target="mainframe">Home</a></body></html>

Link to comment
Share on other sites

This should validate...

<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>Welcome to James' site</title><link rel="stylesheet" type="text/css" href="navigation.css" /><meta http-equiv="content-type" content="text/html; charset=utf-8" /></head><body><a href="home.html" target="mainframe">Home</a></body></html>

Matt

Link to comment
Share on other sites

In future know that you only add the "Frameset" doctype when the page has <frameset> tags in it.This would usually be the index.html page of a framed website.The indivual pages don't have <frameset> tags so a "Frameset" doctype isn't needed. In that case go with either "Transitional" or "Strict". It's your choice.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...