diff options
Diffstat (limited to 'xml.class')
-rw-r--r-- | xml.class | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -49,7 +49,6 @@ function from_xml($xmldata, $p) $this->_p = $p + array('encoding' => "ISO-8859-1"); $this->_arrayforce = array_flip((array)$this->_p['forcearray']); $this->_stack = array(); - $this->_baseclass = get_class($this); unset($this->error); $parser = xml_parser_create($this->_p['encoding']); xml_set_object($parser, $this); @@ -127,7 +126,7 @@ function start_element($parser, $name, $attrs) $name = $this->_p['prefix'] . $name; if (!class_exists($name)) - eval("class $name extends $this->_baseclass { function $name() {} }"); # Extend base class but overwrite constructor with an empty one + eval("class $name extends it_xml {}"); # Extending the base class caused problems with tel_xmlentry if (!$this->_stack && !$this->_p['factory']) array_unshift($this->_stack, &$this); @@ -135,7 +134,7 @@ function start_element($parser, $name, $attrs) array_unshift($this->_stack, new $name); if (!is_a($this->_stack[0], "it_xml")) - $this->error .= "Class $name used in it_xml for <$name> does not extend it_xml: Name clash?\n"; + $this->error .= "Class $name used in it_xml for tag $name does not extend it_xml: Name clash?\n"; if ($attrs) { @@ -152,8 +151,13 @@ function end_element($parser, $name) { if (is_array($this->_stack[1]->$name)) array_push($this->_stack[1]->$name, &$this->_stack[0]); - else if (/*isset XXX NEEDS DEBUGGING for tel detail links */($this->_stack[1]->$name)) - $this->_stack[1]->$name = array($this->_stack[1]->$name, &$this->_stack[0]); + else if (isset($this->_stack[1]->$name)) + { + if (is_a($this->_stack[1]->$name, "it_xml")) + $this->_stack[1]->$name = array($this->_stack[1]->$name, &$this->_stack[0]); + else + $this->error .= "Variable $name used in it_xml for tag {$name} is already used in object: Name clash?\n"; + } else if (isset($this->_arrayforce[$name])) $this->_stack[1]->$name = array(&$this->_stack[0]); else |