i want to remove all children from my xml file before i fill it up again (or create an update but that seemed alot harder). So what i did is
$file = "data.xml";
$xml=simplexml_load_file($file);
$teller=0;
foreach( $entries as $entry ) {
foreach ($xml->xpath('//concerts') as $desc) {
if($teller == 0)
{
$lol=$desc->children();
unset($lol);
}
$concert = $desc->addChild( 'concert' );
$concert->addChild( 'artist', array_shift( $entry ) );
$concert->addChild( 'location', array_shift( $entry ) );
$concert->addChild( 'date', array_shift( $entry ) );
$teller++;
}
}
file_put_contents($file, $xml->asXML());
But this doesn't remove anything, any ideas on what i did wrong?