diff options
Diffstat (limited to 'it_xml.class')
-rw-r--r-- | it_xml.class | 10 |
1 files 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); } } } |