我有像
这样的xml文件<offer>
<WEB>.........</WEB>
<URL>...............</URL>
<![CDATA[
<TITLE>some ......</TITLE>
]]>
<SOLD_AMOUNT>0</SOLD_AMOUNT>
<IMAGE>.....l_offer_438.jpg</IMAGE>
<CITY>town.....</CITY>
<DISCOUNT>50</DISCOUNT>
<ORIGINAL_PRICE>1405</ORIGINAL_PRICE>
<FINAL_PRICE>702</FINAL_PRICE>
<DEAL_END>1323122399</DEAL_END>
</offer>
我如何解析CDATA部分
$sxe = simplexml_load_file($xml,null,LIBXML_NOCDATA);
print_r($sxe);
这种方式不起作用
SimpleXMLElement Object
(
[offer] => Array
(
[0] => SimpleXMLElement Object
(
[WEB] => ghfghfgh
[URL] => fghfgh
[SOLD_AMOUNT] => 0
[IMAGE] => fghfghfgh
[CITY] => dfgdfgdfg
[DISCOUNT] => 50
[ORIGINAL_PRICE] => 1405
[FINAL_PRICE] => 702
[DEAL_END] => 1323122399
[TITLE] => SimpleXMLElement Object
(
)
)
[1] => SimpleXMLElement Object
(
[WEB] => dfgdgdfgdfg
[URL] => fghfghfg
[SOLD_AMOUNT] => 0
[IMAGE] => dfgdfg_offer_433.jpg
[CITY] => dfgdfgdg
[DISCOUNT] => 31
[ORIGINAL_PRICE] => 259
[FINAL_PRICE] => 179
[DEAL_END] => 1323122399
[TITLE] => SimpleXMLElement Object
(
)
)
答案 0 :(得分:0)
试试这个:
$sxe = simplexml_load_file($xml,null);
print_r($sxe);