PHP Recursive Array To XML With DOM

Tagged:  •    •  

This class provides a method to recursively create XML from a PHP array. The functionality is provided by extending the built in Document Object Model (DOM) class. By extending the DOM class, all the functions within are available locally to the array2xml class. The main engine in this class is the createNode method, which is a recursive function that adds the child nodes to the parent root directory.

The constructor takes two arguements, which are the name of the root node, and the default node_name which is applied to array elements that have a numeric index, as numeric XML tags are not permitted.

http://www.phpro.org/classes/PHP-Recursive-Array-To-XML-With-DOM.html