Re: Simple question on simplexml

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
         You can use following example:)

<?php
  $xml = simplexml_load_file("test.xml");
  $xml->body[0]->addChild("book", "Atatürk The Rebirth Of A Nation");
?>

Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

"Timothy Murphy" <tim@xxxxxxxxxxxxxxxxxxxxxx>, haber iletisinde sunlari
yazdi:ev5jkr$lih$1@xxxxxxxxxxxxxxxx
>
> I have a catalog in XML format:
> <?xml version="1.0" encoding="iso-8859-1" ?>
> <catalog>
>  <book>
>    ...
>  <book>
>  <book>
>    ...
>  <book>
>  ...
> </catalog>
>
> Now I want to add another book,
> which I have as a SimpleXMLElement:
>
>        $book = new SimpleXMLElement($string);
>
> where $string reads
>  <book>
>    ...
>  <book>
>
> Can I add this new entry to the catalog
> using SimpleXML functions,
> or do I have to introduce a DOMDocument?
>
> As may be obvious, I am very new to PHP programming;
> and advice or suggestions gratefully received.
>
> -- 
> Timothy Murphy
> e-mail (<80k only): tim /at/ birdsnest.maths.tcd.ie
> tel: +353-86-2336090, +353-1-2842366
> s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux