我有一些 xml,我试图用以下代码用 php 解析:
$data = simplexml_load_file($file_path)
foreach ($data as $obj):
//get author, date, etc
...
// get the paths
foreach ($obj->paths as $current):
$kind = $current['kind'];
$action = $current['action'];
$path = $current->path;
但由于某种原因我无法获得 kind 和 action 属性......路径会起作用,但属性不会
xml 看起来像这样:
<log>
<logentry
revision="xxxx">
<author>xyz</author>
<date>my date</date>
<paths>
<path
kind="file"
action="M">/myPath/woohoo</path>
<path.... *more paths*
....more logentries
谢谢