<?php
  $dom=new DOMDocument();
  $dom->load("inimesed.xml");
  $juur=$dom->documentElement;
  $inimesed=$juur->getElementsByTagName("inimene");
  $juur->removeChild($inimesed->item(0));
  for($i=0; $i<$inimesed->length; $i++){
    echo $inimesed->item($i)->getElementsByTagName("eesnimi")->item(0)->nodeValue." ";
  }
  $inimesed->item(0)->setAttribute("sugu", "m");
  echo $dom->saveXML();
?>