Fixing Common W3C Validation Errors and SEO

Yet another thing to check when doing SEO is that your site validates via the w3c validation checker. A site that is xHTML valid will recieve more frequent search engine crawls and more importantly, longer crawl times. I won’t bore you with further details about why validation is a good thing (it’s a huge subject), but if you must there is a great article about the subject right here. Creating a site to an xHTML valid standard encourages better coding practice and more semantic coding – making your site easier to crawl. You are also giving your site a betttr chance of displaying the same across multiple and future browsers.

Another less known theory is that spiders get full when crawling a page, semantic coding practice will allow for cleaner and more lightweight code. For instance, when crawling a badly coded page with lots of line styles and JavaScript (E.g. content not useful to a spider) the spider may become full too quickly and leave – missing you important content contained further on within the page.

Validating your site to at least xHTML Transaitional 1.0 (the test strict version, compared to xHTMl 1.0 Strict) is highly encouraged and is an area often ignored by developers. Below, I’ll quickly outline some of the common validation errors and how to easily fix them:

cannot generate system identifier for general entity X – 99% of the time this relates to errors with entity references such as ampersands in URLs. E.g. having an url like product.php?id=2&mode=view would result in this error as the ‘&’ wasn;t used within the url.

required attribute “alt” not specified –  simply find the line number and add an alt tag for the image. The presence of an alt tag is required for both transitional and strict doc types.

XML Parsing Error: Opening and ending tag mismatch – Depending on how organised you are when coding this fix can take a matter of seconds or a lot longer. It relates to unclosed block level tags, such as a table or div. One plus point is that fixing such an error often results in several validation errors being fixed at once.

required attribute “TYPE” not specified – This relates to no type attribute being specified for things like script and style tags. Solution – use the type tag like this: <script type=”text/javascript” language=”javascript” src=”scripts.js”>

There is no attribute “HEIGHT” – xHTML does not allow for the presence of the height attributer. To resolve, add an inline style or better, specify the height within the css rule for that element.

NET-enabling start-tag requires SHORTTAG YES or document type does not allow element “META” here – caused by incorrect use of short tags for the page’s doctype. For example if you have specified an HTML doctype then you use use <br> instead of <br />.

ID ‘someDivname’ already defined – caused when you have used two dividers on the same page, with the same id. Solution, uses div class instead of div id if you need multiple dividers on one page.

Missing a required sub element of HEAD – almost definately caused by missing xHTML required tags from the head section. E.g. have you included a title tag (required in all HTML documents.

Published by

Rob Allport

Web Developer based in Stoke-on-Trent Staffordshire Google+ - Twitter

Leave a Reply

Your email address will not be published. Required fields are marked *