javascript XML 验证:解析属性名称时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3431552/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
XML Validation: Error Parsing Attribute Name
提问by Laxmidi
I've got an XML validation problem. This bit:
我有一个 XML 验证问题。这一点:
<script type="text/javascript">
oxm_ad = {"website":"cca9e4b4-7ed2-848z-ffea-067efabc891a",
"size":"468x60",
"floor":"0.01",
"beacon":"<div id='beacon_017a6c9ega' style='position: absolute; left: 0px; top: 0px; visibility: hidden;'><img src='http://www.website.com/openx/www/delivery/lg.php?bannerid=1&campaignid=1&zoneid=4&loc=http%3a%2f%2flocalhost%2fproject-debug%2fproject.html&cb=014a7c8eda&bannerid=-1' width='0' height='0' alt='' style='width: 0px; height: 0px;' </img></div>",
"fallback":"<a href='http://www.website.com/openx/www/delivery/ck.php?oaparams=2__bannerid=1__zoneid=4__cb=014a7c8eda__oadest=http%3a%2f%2fwww.website.com' target='_blank'><img src='http://www.website.com/openx/www/delivery/ai.php?filename=mybanner.png&contenttype=png' width='468' height='60' alt='' title='' border='0' /></a><div id='beacon_014a7c8eda' style='position: absolute; left: 0px; top: 0px; visibility: hidden;'><img src='http://www.website.com/openx/www/delivery/lg.php?bannerid=1&campaignid=1&zoneid=4&loc=http%3a%2f%2flocalhost%2fproject-debug%2fproject.html&cb=014a7c8eda' width='0' height='0' alt='' style='width: 0px; height: 0px;' </img></div>"};
</script>
results in:
结果是:
This page contains the following errors: error on line 5 at column 246: error parsing attribute name
此页面包含以下错误:第 5 行第 246 列错误:解析属性名称时出错
I'm not sure what my error is. Any suggestions on how to correct this problem?
我不确定我的错误是什么。有关如何解决此问题的任何建议?
Thank you!
谢谢!
-Laxmidi
-Laxmidi
回答by eldarerathis
It looks like you're missing the end >on both of your <img>tags. I.e. it should be:
看起来您的>两个<img>标签都缺少结尾。即它应该是:
<img src='... height: 0px;'> </img>
Instead of what you currently have:
而不是你目前拥有的:
<img src='... height: 0px;' </img>
The next line has the same error. See if that fixes the problem?
下一行有同样的错误。看看能不能解决问题?
回答by brian
<img>tag now has no paired </img>end tag instead use <img src="...." />
<img>标签现在没有成对的</img>结束标签,而是使用<img src="...." />

