我有一个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>
Run Code Online (Sandbox Code Playgroud)
我使用xpath和xquery来解析xml.
$xml_str = file_get_contents('xmlfile');
$xml = simplexml_load_string($xml_str);
if(!empty($xml))
{
$nodes = $xml->xpath('//xml/events');
}
Run Code Online (Sandbox Code Playgroud)
我正在得到正确的标题,但我没有得到描述.如何我可以获得cdata内的数据