XmlWriter: Generating XML from PHP

Simon [1] came up with an adaption of the Python xmlwriter in PHP. If you have wddx, you could probably be satisfied with that result too.

01 <?php
02 $array = array(
03 array(\’monkey\’, \’banana\’, \’Jim\’),
04 array(\’hamster\’, \’apples\’, \’Kola\’),
05 array(\’turtle\’, \’beans\’, \’Berty\’),
06 );
07 header(\”Content-type: text/xml\”);
08 $packet_id = wddx_packet_start(\”zoo\” );
09 wddx_add_vars($packet_id, \”array\”);
10 echo $xml = wddx_packet_end($packet_id);
11 ?>

[1] http://simon.incutio.com/archive/2003/04/29/xmlWriter

Leave a Reply