转义特殊字符,如&放大器;在Android的XML [英] escaping special characters like & in android xml

查看:175
本文介绍了转义特殊字符,如&放大器;在Android的XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<string name="app_name">something & something</string> 

给出了一个错误。我怎样才能逃脱呢?

gives an error. How can i escape this?

这是正确的。

<string name="app_name">something &amp; something</string>

或是否有更好的办法?

or is there a better way?

推荐答案

尝试阅读此页:的http:// www.xmlnews.org/docs/xml-basics.html~~MD~~aux 的它看起来像它包含你正在寻找的答案。

Try reading this page: http://www.xmlnews.org/docs/xml-basics.html it looks like it contains the answer you are looking for.

总之,这里是转义字符的列表和逃生code

In summary, here is the list of escaped characters and the escape code

Character   Predeclared Entity
&   &amp;
<   &lt;
>   &gt;
"   &quot;
'   &apos;

引用来自链路

Referenced from the link.

这篇关于转义特殊字符,如&放大器;在Android的XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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