cute
mam nieco take
Kód:
$doc = new DOMDocument("1.0","UTF-8");
$doc->load('../data/fotos.xml');
$fotos = $doc->getElementsByTagName( "foto" );
$newFoto = $doc->createElement("foto");
$newArtist = $doc->createElement("artist","hh");
$newTitle = $doc->createElement("title","ee");
$newFoto->appendChild($newArtist);
$newFoto->appendChild($newTitle);
$fotos->item(0)->parentNode->insertBefore($newFoto,$fotos->item(0));
$doc->save('../data/fotos2.xml');
spravny vylsedok by mal byt:
Kód:
<foto>
<artist>Peter Mrkvička</artist>
<title>Druha</title>
</foto>
ale ono to robi takto:
Kód:
<foto><artist>hh</artist><title>ee</title></foto>
prste hadze to do jedneho riadku, neda sa nejako nastavit aby to robilo tak ako ma ?
vdaka