How to stop w3 Complaining?


I’m trying to get my pages to “validate”, but keep getting annoying errors like:

Line 116, Column 66: cannot generate system identifier for general entity “BID”

…" target=“_blank”>Mexico Golf P…

An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (;). The most common cause of this error is unencoded ampersands in URLs as described by the WDG in “Ampersands in URLs”.

Entity references start with an ampersand (&) and end with a semicolon (;). If you want to use a literal ampersand in your document you must encode it as “&” (even inside URLs!). Be careful to end entity references with a semicolon or your entity reference may get interpreted in connection with the following text. Also keep in mind that named entity references are case-sensitive; &Aelig; and æ are different characters.

If this error appears in some markup generated by PHP’s session handling code, this article has explanations and solutions to your problem.

Note that in most documents, errors related to entity references will trigger up to 5 separate messages from the Validator. Usually these will all disappear when the original problem is fixed.

…with this line:

<a href="" target="_blank">Mexico Golf</a> <br />

Is the ONLY way to fix this, to change & with & in ALL my URLs??

Also getting the same problem with some Javascript, which is getting annoying:

Line 67, Column 149: character “&” is the first character of a delimiter but occurred as data

…nel(title,url,“”)}else if(window.opera&&window.print){var elem=document.create…


This message may appear in several cases:

You tried to include the "&lt;" character in your page: you should escape it as "&lt;"
You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&amp;", which is always safe.
Another possibility is that you forgot to close quotes in a previous tag.

…which is related to this code:

function bookmark_us(){var url=this.location;var title=document.title;if(window.sidebar){window.sidebar.addPanel(title,url,"")}else if(window.opera&&window.print){var elem=document.createElement('a');elem.setAttribute('href',url);elem.setAttribute('title',title);elem.setAttribute('rel','sidebar');}else if(document.all){window.external.AddFavorite(url,title)}}

Is there a simpler way to fix these up? (its showing over 600 “errors” just on one page atm - and all of them seem to be related to this “issue” !)

BTW, the page doctype is set as:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xml:lang="en" lang="en">



An & needs to be codes as & when you include it in HTML. It is one of the two characters in HTML that have special meanings - the other being < (which you would write as < if you want it in your content)


Thanks for the reply - but why does it also moan about stuff like:

if (var == "something" && foo = "bar") {


(in Javascript)

Surely it must just “ignore” JS codes? (cos you have > < & etc in the basic javascript syntax - which you obviously can’t encode :goof:)



Use CDATA to indicate that the code is not to be parsed as html.

	if (var == "something" && foo = "bar") {

Alternately use externally linked scripts. Though like was mentioned above Script is non HTML data. Therefore needs to be treated carefully so that the HTML parser doesn’t interpret the certain characters or sequences like; && or that are legal in JS. As HTML markup, or start mistaking & as start of a character entity reference, etc.

You legend - works a charm :cool:

xhtmlcoder - thanks for the reply. For the most of our JS, we DO have them in a seperate .js file… but for some functions (which are only used on a small number of pages), we have them included directly into the HTML - cos having a seperate .js file for them would increase the page load-time (as it would have to make another 1, or 2 seperate requests to get the file)