だから私は次のxml構造を持っています:
<Application>
<Properties>
<Property>
<Name>blabla</Name>
<Value>123</Value>
</Property>
</Properties>
</Application>
PHPで別の「プロパティ」の子を追加したい。例は次のとおりです。
<Application>
<Properties>
<Property>
<Name>blabla</Name>
<Value>123</Value>
<Name>example test</Name>
<Value>another value</Value>
</Property>
</Properties>
</Application>
これが私の現在のphpコードです:
<?php
$xml = simplexml_load_file("Application.xml");
$sxe = new SimpleXMLElement($xml->asXML());
$properties = $sxe->addChild("Property");
$properties->addChild("Name", "namehere");
$properties->addChild("Value", "random value here");
$sxe->asXML("Application.xml");
?>
ただし、xml の末尾に追加するだけです。その後</Application>
、それは私たちが望んでいるものではありません。
子につけてほしい<Property>
。
誰かが私を助けることができますか?