我有 Google 结帐沙箱生成的 HTML 代码,可以在 HTML 页面中正常工作.当我将相同的代码放在 XHTML 页面中时,它会引发以下异常:
I have Google checkout sandbox generated HTML code which works fine in HTML page. When I put the same code in XHTML page, it throws the below exception:
对实体w"的引用必须以;"结尾分隔符
the reference to entity "w" must end with the ';' delimiter
它在下面的src属性中引用了URL中的请求参数w:
It's referring the request parameter w in the URL in the below 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?
与号 & 是 HTML 和 XML 中的特殊字符.如果要将其用作普通字符,则必须对其进行正确编码.用 & 代替 &:
The ampersand & is a special character in HTML and XML. If you want to use it as a normal character, you have to encode it correctly. Write & instead of &:
src="...9623&w=180&h=46&style=white&variant=text&loc=en_US"
& 表示编码实体的开始,例如 < 表示 <,或 & 用于 &.在您的情况下,解析器尝试将 &w 解释为实体.但是实体总是由 ; 终止,因此如果 ; 丢失,您会收到错误消息.
& denotes the start of an encoded entity, such as < for <, or & for &. In your case the parser tries to interpret &w as an entity. But entities are always terminated by an ;, thus if the ; is missing you get the error message.
这篇关于对实体“foo"的引用必须以 ';' 结尾分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何复制 div onclick 事件?How can I duplicate a div onclick event?(如何复制 div onclick 事件?)
从谷歌驱动器打开 htmlopening html from google drive(从谷歌驱动器打开 html)
如何将视频从 Google 驱动器嵌入到网页?How to embed videos from Google drive to webpage?(如何将视频从 Google 驱动器嵌入到网页?)
如何在 iframe 中查看 Google Drive pdf 链接How to view Google drive pdf link in iframe(如何在 iframe 中查看 Google Drive pdf 链接)
使用 Google Drive API 的 HTML2PDFHTML2PDF using Google Drive API(使用 Google Drive API 的 HTML2PDF)
Google 表单:将数据发送到电子表格Google Forms: Send data to spreadsheet(Google 表单:将数据发送到电子表格)