【发布时间】:2011-02-24 03:13:09
【问题描述】:
我的用户输入带有特殊字符的消息如下:
this is a test of &&, &&, % as well as '' "", " instead of this is a test of &, &&, % as well as '' "", "
我需要按如下方式构造 XML:
<?xml version='1.0' encoding='iso-8859-1'?>
<success>
<message>
this is a test of &, &&, % as well as '' "", " instead of this is a test of &, &&, % as well as '' "", "
</message>
</success>
任何人都可以帮助我吗? 提前致谢
【问题讨论】:
-
您呈现的 xml 格式不正确 - 如果它不是实体引用的一部分(如 &),则 xml 中不能有未转义的 &。
-
更多完整和充实的答案可以在这里的这个问题中找到:stackoverflow.com/questions/3957360/…