Ampersand打破了我的XML加载jQuery [英] Ampersand breaks my XML from loading with jQuery

查看:72
本文介绍了Ampersand打破了我的XML加载jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的描述显示在XML文档中,然后使用jQuery将其加载到应用程序中。



当我尝试使用'&'时,它会破坏加载代码。我也试过了

 & 

它也不起作用。



<是否有解决方法让我在XML中包含&符号?



编辑:结构是......

 < picture title =Namedescription =Adam& Eve的图片>< / picture> 


解决方案

您可以使用&安培; 。 xml解析器将& 视为字符的开头实体 ...和& 本身不是有效的字符实体。

 < picture title =Namedescription =Adam& amp; Eve的图片>< / picture> 


I have descriptions being displayed within an XML document and then loading it into an application with jQuery.

When I try to use '&' it breaks the code from loading. I've also tried

&#38;

and it doesn't work either.

Is there a work around that will let me contain '&' symbols within my XML?

edit: Structure is...

<picture title="Name" description="A picture of Adam & Eve"></picture>

解决方案

You can use &amp;. The xml parser treats & as the start of a character entity...and & by itself is not a valid character entity.

<picture title="Name" description="A picture of Adam &amp; Eve"></picture>

这篇关于Ampersand打破了我的XML加载jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆