Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [xml] Dodawanie elementu, i zapisywanie
flashion
post
Post #1





Grupa: Zarejestrowani
Postów: 53
Pomógł: 1
Dołączył: 4.11.2007

Ostrzeżenie: (0%)
-----


Witam, mam taki kod:

Kod
<?php
    $xml = new DOMDocument;
    $xml->preserveWhiteSpace = false;
    $xml->load("tomek.xml");
    
   $title = $xml->createElement('title');
   $title = $xml->appendChild($title);

    $xml->formatOutput = true;
  $xml->save("tomek.xml");
?>

i ogromną prośbę.
Dlaczego po wykonaniu powyższego kodu, zamiast dodać element 'title' nic się nie dzieje? Raz już mi się udało poprawnie to wykonać, ale zapomniałem jak (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)

Pozdro

// no i sobie poradziłem (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
kod:

Kod
<?php
    $xml = new DOMDocument('1.0');
    $xml->preserveWhiteSpace = false;
    $xml->formatOutput = true;
    $xml->load("tomek.xml");
    
   $title = $xml->createElement('title');
   $xml->appendChild($title);

$xml->save("tomek.xml");
?>


Ten post edytował flashion 4.11.2007, 11:42:41
Go to the top of the page
+Quote Post

Posty w temacie
- flashion   [xml] Dodawanie elementu   4.11.2007, 11:30:29


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 10:30