Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2001092

[PHP] Real tip about XML and PHP From: Augusto Cesar Castoldi (accastoldi <email protected>)
Date: 09/30/01

This week I've been looking for functions to work with
XML.

If you want to create XML files, always use DOMXML
functions (php compile --with-dom).

Here is some code:

<?
  $doc = new_xmldoc ('1.0');

  $root = $doc->add_root('sites');

  $site = $root->new_child('site', '');
    $site->new_child('title', 'PHP.net');
    $site->new_child('url', 'http://www.php.net');

  $site = $root->new_child('site', '');
    $site->new_child('title', 'Test');
    $site->new_child('url',
'http://localhost/teste.php');

  $fp =  <email protected>('tst.xml', 'w');

  if (!$fp)
    die('Error open tst.xml');

  fwrite($fp, $doc->dumpmem());

  fclose($fp);

  echo $doc->dumpmem();
?>

_______________________________________________________________________________________________
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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>