i have values with special chars that encoded to ascii in my xml. for example :
我在xml中有编码为ascii的特殊字符的值。例如:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<name>Žirmūnų</name>
</response>
but when i parse value name
i get only &
as value. Is it allowed to use #
or &
in xml? or i have to use cdata necessarily?
但是当我解析值名时,我只得到& as值。是否允许在xml中使用#或& ?还是必须使用cdata ?
2 个解决方案
#1
15
The & character appears to be illegal, use (below) instead.
与字符似乎是非法的,使用(下面)代替。
&
XML中存在非法字符
The # character should be OK.
#字符应该是OK的。
Also this may be useful: http://xml.silmaril.ie/specials.html.
这也可能是有用的:http://xml.silmaril.ie/specials.html。
#2
5
& needs to be escaped as it is used for esaping itself. All escapes start with & ("
, <
, >
).
需要转义,因为它是用来保存自己的。所有转义都以&开头。
&
is the escape for &
,逃跑是为了& ?
#1
15
The & character appears to be illegal, use (below) instead.
与字符似乎是非法的,使用(下面)代替。
&
XML中存在非法字符
The # character should be OK.
#字符应该是OK的。
Also this may be useful: http://xml.silmaril.ie/specials.html.
这也可能是有用的:http://xml.silmaril.ie/specials.html。
#2
5
& needs to be escaped as it is used for esaping itself. All escapes start with & ("
, <
, >
).
需要转义,因为它是用来保存自己的。所有转义都以&开头。
&
is the escape for &
,逃跑是为了& ?