XML helper

Derek Jones edited this page Jul 5, 2012 · 6 revisions
Clone this wiki locally

Category:Helper::Community | Category:Helper::XML

XML helper for CodeIgniter

Four methods to easily generate XML Download and documentation

Example


$this->load->helper('xml');

$dom = xml_dom();
$book = xml_add_child($dom, 'book');

xml_add_child($book, 'title', 'Hyperion');
$author = xml_add_child($book, 'author', 'Dan Simmons');        
xml_add_attribute($author, 'birthdate', '1948-04-04');

xml_print($dom);

generates


<?xml version="1.0"?>
<book>
  &lt;title&gt;Hyperion&lt;/title&gt;
  <author birthdate="1948-04-04">Dan Simmons</author>
</book>

Jérôme Jaglale