From 0718ca36ffc5764fbe5398a7a541a3740cdd9b0d Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 11 Mar 2010 20:09:55 +0000 Subject: inherit prefix... --- it_xml.class | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/it_xml.class b/it_xml.class index 7dd82c7..bf71031 100644 --- a/it_xml.class +++ b/it_xml.class @@ -332,13 +332,15 @@ function error() * @param values assoc array of key => value pairs. May contain associative or numeric subarrays. */ -function set($vals) +function set($vals, $parentprefix = null) { + $prefix = $parentprefix ? $parentprefix : $this->_p['prefix']; + if (is_array($vals)) { foreach ($vals as $key => $val) { - $classname = $this->_p['prefix'] . $this->_make_identifier($key); + $classname = $prefix . $this->_make_identifier($key); if (!class_exists($classname)) eval("class $classname extends it_xml {}"); @@ -349,7 +351,7 @@ function set($vals) { if (!is_a($arr[$i], "it_xml")) $arr[$i] = new $classname; - $arr[$i]->set($v); + $arr[$i]->set($v, $prefix); } $this->$key = $arr; } @@ -357,7 +359,7 @@ function set($vals) { if (!is_a($this->$key, "it_xml")) $this->$key = new $classname; - $this->$key->set($val); + $this->$key->set($val, $prefix); } } } -- cgit v1.2.3