1
我正面临一个Xml问题。可能是一些愚蠢的,但我不能看到它... ...Php xml,用xml对象代替正在使用的节点
这是我在开始创建XML:
<combinations nodeType="combination" api="combinations">
<combination xlink:href="http://localhost:8888/vmv/ps/api/combinations/1">
<id><![CDATA[1]]></id>
</combination>
<combination xlink:href="http://localhost:8888/vmv/ps/api/combinations/2">
<id><![CDATA[2]]></id>
</combination>
</combinations>
因此,对于每一个节点,我做的API调用,然后我想,以取代由节点返回的值,这样的:
$c_index = 0;
foreach($combinations->combination as $c){
$new = apiCall($c->id); //load the new content
$combinations->combination[$c_index] = $new;
$c_index++;
}
如果我转储$新进的foreach,我得到了一个simplexmlobject这是很好的,但如果我转储$ combinations->组合[$ X],我已经得到了很大的字符串空白...
我想获得:
<combinations nodeType="combination" api="combinations">
<combination xlink:href="http://localhost:8888/vmv/ps/api/combinations/1">
<my new tree>
....
</my new tree>
</combination>
<combination xlink:href="http://localhost:8888/vmv/ps/api/combinations/2">
<my new tree>
....
</my new tree>
</combination>
</combinations>
我必须缺少一些东西,但是什么......?这就是问题...
感谢您的帮助!