【发布时间】:2010-09-06 09:05:55
【问题描述】:
我有一个 xml 文件
<?xml version="1.0" encoding="utf-8"?>
<xml>
<events date="01-10-2009" color="0x99CC00" selected="true">
<event>
<title>You can use HTML and CSS</title>
<description><![CDATA[This is the description ]]></description>
</event>
</events>
</xml>
我使用 xpath 和 xquery 来解析 xml。
$xml_str = file_get_contents('xmlfile');
$xml = simplexml_load_string($xml_str);
if(!empty($xml))
{
$nodes = $xml->xpath('//xml/events');
}
我得到了正确的标题,但我没有得到描述。我怎样才能得到里面的数据 cdata
【问题讨论】: