gpt4 book ai didi

html - 对实体 "foo"的引用必须以 ';' 分隔符结尾

转载 作者:技术小花猫 更新时间:2023-10-29 11:29:26 25 4
gpt4 key购买 nike

我有 Google checkout 沙箱生成的 HTML 代码,它在 HTML 页面中运行良好。当我将相同的代码放入 XHTML 页面时,它会抛出以下异常:

the reference to entity "w" must end with the ';' delimiter

它在下面的 src 属性中引用了 URL 中的请求参数 w:

<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" />

这是怎么引起的,我该如何解决?

最佳答案

与号 &是 HTML 和 XML 中的特殊字符。如果要将其用作普通字符,则必须正确编码。 &amp;而不是 & :

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

&表示编码实体的开始,例如 &lt;对于 < , 或 &amp;对于 & .在您的情况下,解析器尝试解释 &w作为一个实体。但是实体总是以 ; 终止。 ,因此如果 ;缺少您会收到错误消息。

关于html - 对实体 "foo"的引用必须以 ';' 分隔符结尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6483807/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com