我使用PHP来生成XML文件。我使用下面的一些代码来避免错误。如何解决“simplexml_load_file()解析器错误:实体'nbsp'未定义”?
$str = str_ireplace(array('<','>','&','\'','"'),array('<','>','&',''','"'),$str);
但仍导致错误。
simplexml_load_file() [function.simplexml-load-file] *[file name]* parser error : Entity 'nbsp' not defined in *[file name] [line]*
错误文本的位置:
Dallas Dallas() is the third-largest city in Texas and the ninth-largest in the United States.
在IE8,它似乎在()
故障。那么我应该注意到多少个符号?
' '在默认情况下未在XML中定义。也许只是用一个空间替换它就足够了? – 2011-06-01 23:14:11
你说你使用PHP来*生成* XML文件;你在用什么?如果你使用的是正确的工具,它应该为你处理这些实体... – 2011-06-01 23:16:35