The reference to the object "foo" must end with the symbol ';' limiter

I have HTML code generated using Google Checkout that works fine on an HTML page. When I put the same code on an XHTML page, it throws the following exception:

entity reference "w" must end with the character ';' Separator

It refers to the request parameter w in the URL below the src attribute:

 <input type="image" name="Google Checkout" alt="Fast checkout through Google" src="http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=211512493599623&w=180&h=46&style=white&variant=text&loc=en_US" height="46" width="180" /> 

How is this caused and how can I solve it?

+59
html xhtml xml-parsing
Jun 26 '11 at 12:13
source share
1 answer

Ampersand & is a special character in HTML and XML. If you want to use it as a regular character, you need to encode it correctly. Write &amp; instead of & :

 src="...9623&amp;w=180&amp;h=46&amp;style=white&amp;variant=text&amp;loc=en_US" 

& denotes the beginning of an encoded object, for example &lt; for < , or &amp; for & . In your case, the parser tries to interpret &w as an entity. But objects always end with ; therefore, if absent ; , you get an error message.

+139
Jun 26 '11 at 12:28
source share



All Articles