/** * Constructor. Do basic error checking on the resposne. * * @param DOMElement $element The DOM element we're encapsulating. */ public function __construct($element = null) { parent::__construct($element); if ($this['stat'] != 'ok') { throw new Horde_Service_Scribd_Exception($this->error['message'], $this->error['code']); } }
/** * Constructor. * * @param resource|string $xml The XML document received from the server. */ public function __construct($xml) { if (is_resource($xml)) { rewind($xml); $xml = stream_get_contents($xml); } parent::registerNamespace('xlink', 'http://www.w3.org/1999/xlink'); parent::__construct($xml); }
public function testIllegalFromArray() { $failed = false; $e = new Horde_Xml_Element('<element />'); try { $e->fromArray(array('#name' => array('foo' => 'bar'))); } catch (InvalidArgumentException $e) { $failed = true; } $this->assertTrue($failed); }
/** * Ensure that $_listItems is populated by calling the concrete implementation's * _buildItemsCache() method. */ public function __wakeup() { parent::__wakeup(); $this->_listItems = $this->_buildListItemCache(); }
/** * Required by the ArrayAccess interface. * * @internal */ public function offsetUnset($offset) { if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); $result = $this->_element->removeAttributeNS(Horde_Xml_Element::lookupNamespace($ns), $attr); } else { $result = $this->_element->removeAttribute($offset); } if ($result) { $this->_expireCachedChildren(); return true; } else { return false; } }
public function __construct($uri = 'http://www.example.com/myfeed/', $xml = null) { parent::__construct($uri, $xml); Horde_Xml_Element::registerNamespace('myns', 'http://www.example.com/myns/'); }