cvs: pear /XML_Serializer Serializer.php
| From: | Stephan Schmidt | Date: | Fri, 23 Apr 2004 17:17:04 +0000 |
| Subject: | cvs: pear /XML_Serializer Serializer.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-18646@lists.php.net to get a copy of this message | ||
schst Fri Apr 23 13:17:04 2004 EDT
Modified files:
/pear/XML_Serializer Serializer.php
Log:
added rootName option to default options
added comment
http://cvs.php.net/diff.php/pear/XML_Serializer/Serializer.php?r1=1.14&r2=1.15&ty=u
Index: pear/XML_Serializer/Serializer.php
diff -u pear/XML_Serializer/Serializer.php:1.14 pear/XML_Serializer/Serializer.php:1.15
--- pear/XML_Serializer/Serializer.php:1.14 Sun Oct 26 14:38:21 2003
+++ pear/XML_Serializer/Serializer.php Fri Apr 23 13:17:04 2004
@@ -16,7 +16,7 @@
// | Authors: Stephan Schmidt <schst@php-tools.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Serializer.php,v 1.14 2003/10/26 19:38:21 schst Exp $
+// $Id: Serializer.php,v 1.15 2004/04/23 17:17:04 schst Exp $
/**
* uses PEAR error management
@@ -122,6 +122,7 @@
"mode" => 'default', //
use 'simplexml' to use parent name as tagname if transforming an indexed array
"addDoctype" => false, // add a
doctype declaration
"doctype" => null, // supply a
string or an array with id and uri ({@see XML_Util::getDoctypeDeclaration()}
+ "rootName" => null, // name of the
root tag
"rootAttributes" => array() // attributes
of the root tag
);
@@ -330,6 +331,10 @@
*/
function _serializeArray(&$array, $tagName = null, $attributes = array())
{
+ /*
+ * if mode is set to simpleXML, check whether
+ * the array is associative or indexed
+ */
if (is_array($array) && $this->options["mode"] ==
"simplexml") {
$indexed = true;
foreach ($array as $key => $val) {