获取实体名称必须紧跟在 java 中实体引用错误中的“&”之后,但我的 xml 文件中没有任何 & 符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20230551/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 00:27:04  来源:igfitidea点击:

Getting a The entity name must immediately follow the '&' in the entity reference error in java, but I dont have any ampersands in my xml file

javaxml

提问by ravensgo

I am getting the error

我收到错误

The entity name must immediately follow the '&' in the entity reference.

but I don't have any ampersands in my XML document! Does anyone know why this might happen? Here is the XML document I am trying to parse:

但我的 XML 文档中没有任何 & 符号!有谁知道为什么会发生这种情况?这是我试图解析的 XML 文档:

<rss version= "2.0" >
<channel>
<item>
<title>Best iPad strategy games</title>
<link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/198mhX3FVmw/story01.htm</link>          </item>
<item>
<title>Share your life with friends in real time with Spin</title>
<link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/9G84sETG_9I/story01.htm</link>    </item>
<item>
<title>How to stop receiving notifications from a website in OS X Mavericks</title>
<link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/IyxFbLcmoOE/story01.htm</link>   </item>
<item>
<title>iPad mini with Retina Display hitting resellers in the UK, 4G LTE models still     look scarce</title>
<link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/FGTUITMMR0E/story01.htm</link>  </item>
<item>
<title>Procraster for iPhone helps you fight procrastination and break down large projects</title>
<link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/o5ATGmzDthw/story01.htm</link></item>
<item><title>Pad & Quill brings ages-old craftsmanship to all new leather bags and sleeves</title>        <link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/NJzAu_PyQNo/story01.htm</link></item>
<item><title>BillGuard 4.0 for iPhone brings spending analytics, savings alerts, and more</title>   <link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/HY4zCH7l1QM/story01.htm</link></item>
<item><title>GTA: San Andreas coming to iOS in December, game controller support in tow</title><link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/SVNSBiViJdk/story01.htm</link></item>
<item><title>QuizUp developer Plain Vanilla fixes server issues that left user data vulnerable</title><link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/Nzhq0f5O3Ns/story01.htm</link></item>
<item><title>Iterate 58: Paul Haddad on Tweetbot 3</title><link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/XJ4dCJWZFVo/story01.htm</link></item>
<\item><title>Deal of the Day: Incipio EDGE PRO Hard Shell Slider Case for iPhone 5S</title><link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/ypt-j2OBqOM/story01.htm</link></item>
<item><title>Moshi Ionbank 10k battery pack review: Good looks and plenty of power</title>   <link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/0HUTAMqX82k/story01.htm</link></item>
<item><title>Infinity Blade goes free for Black Friday week</title>    <link>http://feedproxy.google.com/~r/TheIphoneBlog/~3/q0XdepWSTiM/story01.htm</link></item>    <item><title>Procreate 2 for iPad now available, adds 64-bit, iOS 7 design, new GPU    accelerated filters, and more</title>   
</channel></rss>

Thanks in advance for any help!

在此先感谢您的帮助!

采纳答案by rgettman

Yes, you do have an ampersand:

是的,您确实有一个&符号:

<item><title>Pad & Quill

Try

尝试

<item><title>Pad &amp; Quill

Also, this was probably a typo: <\item><title>Deal of the Daywhich you can correct by removing the backslash.

此外,这可能是一个错字:<\item><title>Deal of the Day您可以通过删除反斜杠来更正。

回答by Suyog Gunjal

In string.xml

在 string.xml 中

Every ampersand should be replaced by

每个与号都应替换为

    &amp;