0
我想解析rss xml送紙器,但在解析時有一些內容丟失。我已經附上了我的RSS飼料和解析的反應,請告訴我,如果有其他方式?如何在PHP中解析XML文件?
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<item>
<ids>701</ids>
<post_date>2015-10-30 12:51:30</post_date>
<post_content><blockquote>I personally feel that there is a need to re?invent the very dynamic of contemporary art, to approach it afresh... </blockquote>
Since 2008, the Devi Art Foundation has been making waves as a unique non?profit centre for contemporary artistic practice in India.
<strong>Heading:</strong> As founder of the Devi Art Foundation, you pioneered a unique and avant?
<strong>Anupam Poddar: </strong>There are many factors that culminated in the Foundation being established.
</post_content>
</item>
</channel>
和響應是這樣
Array
(
[@attributes] => Array
(
[version] => 2.0
)
[channel] => Array
(
[item] => Array
(
[0] => Array
(
[ids] => 701
[post_date] => 2015-10-30 12:51:30
[post_content] => Array
(
[blockquote] => I personally feel that there is a need to re?invent the very dynamic of contemporary art, to approach it afresh...
[strong] => Array
(
[0] => Heading:
[1] => Anupam Poddar:
)
)
)
)
)
)
而我的分析方法是
$xml = simplexml_load_string($details, "SimpleXMLElement", LIBXML_NOCDATA);
$json = json_encode($xml);
$array = json_decode($json, TRUE);
我意識到我的答案已被破壞(對不起,在移動設備上寫道),所以我刪除了它。 SimpleXML不支持訪問節點之間的數據。在[此答案](http://stackoverflow.com/a/20177247/2057919)中查看解決方案/解決方法。 –