Validation Error on script

Hello I am getting this error and I tried fixing it but cant seem to…

Line 15, Column 89: cannot generate system identifier for general entity “sensor”

…aps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script>

:email:
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 “&amp;” (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 &aelig; 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.

So if &amp; represents the & character, what characters do
&sensor and &libraries represent ?

huh not sure what your talking about. this is code I got from google maps I didnt write it…

If you got hte code from google and it works, I wouldn’t worry about this validation error.

1 Like

yea it does work… Most likely it is because I am using HTML5 code on XHTML doc type…

I doubt the doctype matters in this case; although you can certainly try changing your doctype. Throw this in instead

<!doctype html>

Again, I doubt your validation error will go away, but hey, screw it.

Ha half of my errors went away including that one! thanks!

XHTML is a bit too strict so you should probably just stick with the one I gave unless you have a pressing reason for doing XHTML.

You’re welcome :slight_smile: .

Yes I should just stick to HTML5…

Also XHTML5 (and the earlier versions of XHTML) don’t work with Internet Explorer 8 or earlier - the page just gets offered for download instead of displaying in those browsers.

One place where XHTML5 is less strict than HTML5 is that XHTML5 doesn’t need the doctype as it only has one display mode.

1 Like

I believe that the point that @Mittineague was making is that the HTML validator does not recognize &sensor and &libraries as valid markup; therefore, it flags them as errors. The validator flags known errors and assumes unrecognized code is an error. It doesn’t recognize google’s “creative” code. With experience, you learn to tell the difference between legitimate errors and “erroneous errors”.

2 Likes

I see…thanks

That google code should have been written as

v=3.exp&amp;sensor=false&amp;libraries

then it would both work and pass validation

1 Like

Great thanks…just for knowledge purposes why is the original code v=3.exp&sensor=false&libraries and the browser could not read it?

It needs you to escape the ampersand character into HTML code. So & needs to turn into & for it to be valid.

In HTML a & character is the start of an entity code for example

&amp; is an &
&lt; is a < character
&copy; is a © character

The error is because &sensor isn’t a valid entity code

ohhh got it thanks!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.