$_rootName
$_rootName :
Name of the root element for this XMl. Defaults to root.
Class used to write XMl document.
Extends XMLWriter (PHP5 only!)
Initialize the class: $this->load->library('MY_Xml_writer'); $xml = new MY_Xml_writer; $xml->initiate();
Start a branch with attributes: $xml->startBranch('car', array('country' => 'usa', 'type' => 'racecar'));
End (close) a branch $xml->endBranch();
Add a CDATA node with attributes: $xml->addNode('model', 'Corolla', array('year' => '2002'), true);
Print the XMl directly to screen: $xml->getXml(true);
Pass the XMl to a view file: $data['xml'] = $xml->getXml(); $this->load->view('xml_template', $data);
addNode(string $name, string $value, $attributes = array(), boolean $cdata = false) : void
Add a node, typically a child to a branch.
If you wish to create a simple text node, just set $name and $value. If you wish to create a CDATA node, set $name, $value and $cdata. You can set attributes for every node, passing a key=>value $attributes array
string | $name | |
string | $value | |
$attributes | ||
boolean | $cdata |