...

View Full Version : Validator throwing up unexplained errors



quartzy
06-06-2010, 04:30 PM
I have been checking my webpages for errors and the first thing is that the validator thinks the documents are HTML when they are XHTML
This is the doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta content="en-gb" http-equiv="Content-Language" /><meta content="text/xhtml; charset=utf-8" http-equiv="Content-Type" />
Other errors I do not understand is

EntityRef: expecting ';'

…"external" title="link to google maps"(this bracket highlighted red)>Google Maps</a> and type in our postcod…



required attribute "action" not specified

…lass="heading">Latest News and Events</h2><h3>Calendar</h3><form name="tstest">


attributes construct error

… EM BEE Home page">TEN EM BEE Home page</em></a></h1><p class="logtitle">"When…
(no idea at all with this one)

<p class="borders2">Otherwise if you are in a related business <script type="text/javascript" src="js-files/mail.js"></script><noscript><p>Sorry, you need Javascript enabled to email us.</p></noscript>

The validator accepted other <noscript> tags so why will it not accept this one?

Can anyone help me, going mad.

SB65
06-06-2010, 06:28 PM
Hard to answer all of these without a link to your page or at least your full code.

Your doctype looks OK to me - need to see the whole page for this.


…"external" title="link to google maps"(this bracket highlighted red)>Google Maps</a> and type in our postcod…

Do you actually have "(this bracket highlighted in red)" in your code? If so that's the problem - looks like you could just delete this.

Required attribute "action" not specified

…lass="heading">Latest News and Events</h2><h3>Calendar</h3><form name="tstest">

It's telling you the problem here - the form tag requires an action - which will be the file to which data in the form is passed for processing.

Attribute construct error:


… EM BEE Home page">TEN EM BEE Home page</em></a></h1><p class="logtitle">"When…
(no idea at all with this one)

Guessing that that attribute we can only see the end of is an ID, then it's the spaces in the attribute that are causing the problem. Otherwise, need to see your full code...

Apostropartheid
06-06-2010, 08:20 PM
Yes, more detail is needed on most of these points.

mbaker
06-06-2010, 08:55 PM
I have been checking my webpages for errors and the first thing is that the validator thinks the documents are HTML when they are XHTML
This is the doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta content="en-gb" http-equiv="Content-Language" /><meta content="text/xhtml; charset=utf-8" http-equiv="Content-Type" />
Which validator are you using?

When I complete your code snippet with: <title></title></head><body></body></html> the w3c validator reports: This document was successfully checked as XHTML 1.0 Transitional!

One way to confuse the w3c validator is to select a doctype from the drop down list instead of (detect automatically).


EntityRef: expecting ';'

…"external" title="link to google maps"(this bracket highlighted red)>Google Maps</a> and type in our postcod…

If your URL contains &, to be valid HTML you need to write &amp;

For example if your URL contains: ?q=ox18+4ab&ie=UTF8&hl=en&hq=&hnear=Burford,+Oxfordshire you need to write: ?q=ox18+4ab&amp;ie=UTF8&amp;hl=en&amp;hq=&amp;hnear=Burford,+Oxfordshire

The w3c validator error message for Entity Ref errors contains a link to a page that gives a very full description of what you need to do to fix ampersands in URLs.


required attribute "action" not specified

…lass="heading">Latest News and Events</h2><h3>Calendar</h3><form name="tstest">

As SB65 pointed out, every form must have an action attribute, even if it is only <form action="">


attributes construct error

… EM BEE Home page">TEN EM BEE Home page</em></a></h1><p class="logtitle">"When…
(no idea at all with this one)

This occurs when you don't have a space between two attributes, as in: <em class="myclass"title="TEN EM BEE Home page">TEN EM BEE Home page</em> instead of the valid: <em class="myclass" title="TEN EM BEE Home page">TEN EM BEE Home page</em>


<p class="borders2">Otherwise if you are in a related business <script type="text/javascript" src="js-files/mail.js"></script><noscript><p>Sorry, you need Javascript enabled to email us.</p></noscript>

The validator accepted other <noscript> tags so why will it not accept this one?

You need to close the <p class="borders2"> before you start the <noscript>.

quartzy
06-06-2010, 11:45 PM
I dont think that the validator was feeling very well, when it first done my scripts apart from the <noscript> I have not changed anything and now one page has passed that did not before.

I would like to post my code link but it is very very wide and very condensed and not very good, I am having problems previously posted in this forum, also it seems I have a BOM mark but I dont know where from, I am using sharepoint designer 2007, as I like the interface of this, but I do code, but if anyone could look at this page, would be great as the validator thinks that the <div id="wrapper"> is wrong for some reason. www. tenembee.org. uk/useful-links.html

quartzy
06-07-2010, 12:07 AM
All of the above are now sorted, it seems that the validator does not like condensed code.

mbaker
06-07-2010, 12:37 AM
When working on your pages it would probably help to take a copy, and insert a line break after every >. It will make locating problems in the source easier.


Line 6, Column 998: document type does not allow element "noscript" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag
…="js-files/mail.js"></script><noscript><span>Sorry, you need Javascript enable…

The context here is:


<p class="borders2">
Otherwise if you are in a related business <script type="text/javascript" src="js-files/mail.js">
</script>
<noscript>
<span>
Sorry, you need Javascript enabled to email us.</span>
</noscript>
us to see if it would be mutually beneficial to link reciprocally.</p>

The problem is that while <script> is allowed inside of <p>, <noscript> is not.

One solution would be to do without the <noscript> as in:


<p class="borders2">
<span id="email">
Sorry, you need Javascript enabled to email us.</span>
</p>
<script type="text/javascript" >
var email = getEmail();
var message = "Otherwise if you are in a related business " + email + " us to see if it would be mutually beneficial to link reciprocally.";
document.getElementById( "email" ).innerHTML = message;
</script>

You would then need to modify js-files/mail.js so that instead of ending: document.write("<a href='mailto:"+link+"'>Email</a>"), it was set up as a function (getEmail()) that ends: return "<a href='mailto:"+link+"'>Email</a>";


Line 6, Column 80: attributes construct error
…an></a></li><li><a href="policies.html"><span>Policies</span></a></li><li><a h…

When I look at a version of your page with line breaks (as suggested above) this error is reported as:


Line 176, Column 36: attributes construct error
<a href="http://www.lewisham.org.uk"rel="external" title="link to lewisham coun…

The problem is that there is no space between href="http://www.lewisham.org.uk" and rel="external"

The rest of the errors cascade from this single error.

quartzy
06-07-2010, 12:43 AM
Many thanks for your help, particularly the noscript thing which I will adopt when I get time. I relise that I should insert a break but I use the sharepoint designer optimiser and it just shrinks everything. Otherwise I would be doing the site forever, also he changes it often. But learning again which is great.

abduraooft
06-07-2010, 09:48 AM
This is the doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta content="en-gb" http-equiv="Content-Language" /><meta content="text/xhtml; charset=utf-8" http-equiv="Content-Type" />
FYI, only the first tag constitutes your DOCTYPE (http://www.w3.org/QA/2002/04/valid-dtd-list.html).

Apostropartheid
06-07-2010, 04:52 PM
FYI, only the first tag constitutes your DOCTYPE (http://www.w3.org/QA/2002/04/valid-dtd-list.html).

Also, text/xhtml is not the XHTML MIME type: it is application/xhtml+xml (or application/xml). However, as the browser ignores this, taking the HTTP header, and only scans it for the charset, text/html should be used. Note well that XHTML Transitional should not be used for newly-authored documents.

quartzy
06-07-2010, 06:15 PM
Hello again
Can you explain why I could not use XHTML transitional for new documents? The doctype I had to find, as the validator did not like the just bare ones, and the xml kept throwwing the pages out with IE.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum