我需要生成一个可编辑的xml文件,以便为Flash网站提供内容。
我使用html表单生成我的文件,htmlspecialchars
例如:
$currentItem = htmlspecialchars(stripslashes($currentItem));
这是为了防止xml条目产生错误“XML解析错误:格式不正确”,例如
<entry title="Words & Things">
---------------------^
它的副作用是使flash文件显示内容的html代码,而不是正确的字符。
一旦将代码读入Flash文件(as3),是否有一种很好的方法可以将代码转换回来?
答案 0 :(得分:2)
也许试试:
public function htmlUnescape(str:String):String
{
return new XMLDocument(str).firstChild.nodeValue;
}
(发现于:http://www.razorberry.com/blog/archives/2007/11/02/converting-html-entities-in-as3/)
答案 1 :(得分:-2)
使用html_entity_decode
:http://us.php.net/manual/en/function.html-entity-decode.php