Trying to create xml file and get warning.
尝试创建xml文件并得到警告。
WARNING 'SimpleXMLElement::addChild(): unterminated entity reference Brantford Jonson'
警告'SimpleXMLElement::addChild():不终止实体引用Brantford Jonson'
so when i try to open xml file get error
所以当我尝试打开xml文件时,会出现错误
This page contains the following errors:
error on line 3 at column 4: StartTag: invalid element name
Below is a rendering of the page up to the first error.,
i think my error is related with this php warning.
我认为我的错误与这个php警告有关。
here is relevant code
下面是相关代码
if ($value instanceof Zend_Config) {
$child = $xml->addChild($key);
$this->_addBranch($value, $child, $xml);
} else {
$xml->addChild($key, (string) $value);
}
can you help me to pin point why this error occurs. Tried something like this
你能帮我解释一下为什么会出现这个错误吗?试过这样
if ($value instanceof Zend_Config) {
$child = $xml->addChild($key);
$this->_addBranch($value, $child, $xml);
} else {
$xml->$key((string) htmlspecilalchars($value));
}
1 个解决方案
#1
4
I ran across the error when there was an ampersand "&" in my XML. Maybe try escaping the string with htmlspecialchars().
当我的XML中有一个与号“&”时,我遇到了这个错误。可能尝试使用htmlspecialchars()来摆脱字符串。
#1
4
I ran across the error when there was an ampersand "&" in my XML. Maybe try escaping the string with htmlspecialchars().
当我的XML中有一个与号“&”时,我遇到了这个错误。可能尝试使用htmlspecialchars()来摆脱字符串。