是字符 # 或 &允许在 xml 中? [英] are characters # or & allowed in xml?

查看:27
本文介绍了是字符 # 或 &允许在 xml 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 xml 中有编码为 ascii 的特殊字符的值.例如:

i have values with special chars that encoded to ascii in my xml. for example :

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <name>&#381;irm&#363;n&#371;</name>
</response>

但是当我解析值 name 时,我只得到 & 作为值.是否允许在 xml 中使用 #& ?还是我必须使用 cdata?

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?

推荐答案

The &字符似乎是非法的,请改用(下).

The & character appears to be illegal, use (below) instead.

&amp;

XML 中的无效字符

# 字符应该没问题.

这也可能有用:http://xml.silmaril.ie/specials.html.

这篇关于是字符 # 或 &amp;允许在 xml 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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