Re: working with XML
| From: | Augusto Cesar Castoldi | Date: | Wed, 17 Oct 2001 16:20:36 +0000 |
| Subject: | Re: working with XML | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71354@lists.php.net to get a copy of this message | ||
You'll need to use the "DOM XML functions", that you
can find on PHP Manual.
You'll need to rebuild PHP with the option
"--with-domxml=<dir>" (I guess).
This is an example:
<?
$doc = new_xmldoc ('1.0');
$root = $doc->add_root('NightMessage');
$site = $root->new_child('message', '');
$site->new_child('id', '1');
$site->new_child('text', 'Esse e a mensagem
1.');
$site->new_child('cell', '99823640');
$site->new_child('cell', '99823640');
$site->new_child('cell', '99823641');
$site->new_child('cell', '99823642');
$site->new_child('cell', '99823643');
$site = $root->new_child('message', '');
$site->new_child('id', '1');
$site->new_child('text', 'Esse e a mensagem
2.');
$site->new_child('cell', '91016100');
$site->new_child('cell', '91016100');
$site->new_child('cell', '91016101');
$site->new_child('cell', '91016102');
$site->new_child('cell', '91016103');
echo $doc->dumpmem();
$fp = @fopen('nightmessage.xml', 'w');
fwrite($fp, $doc->dumpmem());
fclose($fp);
?>
see you.
Augusto
--- Olexandr Vynnychenko <supaboy@i.com.ua> escreveu:
> Hello php-general,
>
> People, does anybody know something about XML
> functionality of PHP?
> Is there, for example, a function which can insert
> some data into
> XML at some position:
>
> $xml = '<doc>
> <title>Document</title>
> <body></body>
> </doc>'
>
> $res = insert_xml($xml, "/doc/body",
> "<img>draw.jpg</img>");
>
> $res: <doc>
> <title>Document</title>
> <body><img>draw.jpg</img></body>
> </doc>'
>
> Or maybe some other functionality? Thanks!
>
> --
> Best regards,
> Olexandr Vynnychenko
> mailto:supaboy@i.com.ua
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
_______________________________________________________________________________________________
Yahoo! GeoCities
Tenha seu lugar na Web. Construa hoje mesmo sua home page no Yahoo! GeoCities. É fácil e grátis!
http://br.geocities.yahoo.com/