private function parseStructOrReference(SimpleXMLElement $item, $namePrefix) { $obj = null; if (isset($item['reference'])) { if (count($item->children()) > 0) { throw new Exception('reference and embeded struct cannot coexists in tag ' . (string) $item->getName()); } $obj = new WebcReference($namePrefix . (string) $item['name']); $obj->setTarget((string) $item['reference']); $this->_references[$namePrefix . (string) $item['name']] = $obj; } else { if (count($item->children()) > 0) { $obj = new WebcStruct($namePrefix . (string) $item['name']); foreach ($item->children() as $subItem) { $obj->addObject($this->parseObject($subItem, $obj->getFullName() . '_')); } $this->_structs[$namePrefix . (string) $item['name']] = $obj; } else { throw new Exception('empty object detected in tag ' . (string) $item->getFullName()); } } return $obj; }