[英]android - string.xml parsing error
i have made a string named info_data as follows 我已经创建了一个名为info_data的字符串,如下所示
<string name="info_address">SVG Service Verlags GmbH & Co. KG\n
Schwertfegerstra?e 1-3\n
D-23556 L?beck\n
</string>
i am getting an xml error saying that 我收到一个xml错误说
Multiple annotations found at this line: - The entity name must immediately follow the '&' in the entity reference. 在此行找到多个注释: - 实体名称必须紧跟实体引用中的“&”。 - error: Error parsing XML: not well-formed (invalid token)
- 错误:解析XML时出错:格式不正确(令牌无效)
this error comes on the first line containing the &. 此错误出现在包含&的第一行。
what is going wrong and how do i fix it. 出了什么问题,我该如何解决它。
thank you in advance. 先感谢您。
You can't use the & sign. 你不能使用&符号。 Try
&
尝试
&
(I haven't tested it but it may work). (我没有测试它,但它可能工作)。
I believe you will need to change the &
to &
我相信你需要改变
&
到&
. 。
<string
name="info_address">SVG Service Verlags GmbH & Co. KG\n Schwertfegerstra?e 1-3\n
D-23556 L?beck\n</string>
copy paste the code i have pasted. 复制粘贴我粘贴的代码。 use this string use
&
使用此字符串使用
&
instead of & 代替 &
While other answers about the ampersand may be correct, I don't think its just that. 虽然关于&符号的其他答案可能是正确的,但我认为不是这样。
This should be of some use. 这应该是有用的。
Where an attribute value is a string, double backslashes ('\\') must be used to escape characters — for example, '\\n' for a newline or '\\uxxxx' for a Unicode character.
如果属性值是字符串,则必须使用双反斜杠('\\')来转义字符 - 例如,换行符为'\\ n',Unicode字符为'\\ uxxxx'。
You have \\n, which may need to be \\\\n in addition to the change to the & 你有\\ n,除了对&的更改之外,它可能需要是\\\\ n
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.