i Aşağıdaki xml dosyası var.
<question id="1">2011-01-07 23:59:38</question>
<question id="2">2011-01-08 0:01:44</question>
<question id="3"></question>
i yeni bir soru öğesi ekleme. ancak buraya ekleyerek tutar:
<question id="1">2011-01-07 23:59:38</question>
<question id="2">2011-01-08 0:01:44</question>
<question id="3"></question><question id="4"></question>
Ziyade, i yeni eleman bu gibi yeni bir hat eklenecek istiyorum:
<question id="1">2011-01-07 23:59:38</question>
<question id="2">2011-01-08 0:01:44</question>
<question id="3"></question>
<question id="4"></question>
How can i achieve this? Here is my adding new element part of my code:
$question2 = $xpath->query("/question[position()=last()]->value(0)");
$id2 = $question2->getAttribute('id');
$item2 = $dom->createElement("question");
$question2->parentNode->insertBefore($item2, $question2 ->nextSibling);
$item2->setAttribute('id', $row['idquestions']);
Teşekkürler!