public function setValue($value) { if (GagawaUtil::gagawaIsEmpty($value)) { throw new Exception("Attribute values cannot be " . "empty!"); } $this->value_ = $value; }
/** * Removes the first instance of child from this * FertileNode. Once the first instance of the child * is removed, this function will return. It returns * true if a child was removed and false if no child * was removed. */ public function removeChild($childNode = NULL) { if (GagawaUtil::gagawaIsEmpty($childNode)) { throw new Exception("You cannot remove an empty " . "child node!"); } for ($i = 0; $i < count($this->children_); $i++) { $child = $this->children_[$i]; if ($child === $childNode) { unset($this->children_[$i]); return true; } } return false; }
/** * Removes an attribute from this Node, by name. The name * of the attribute to remove cannot be NULL; if so, this * function will throw an Exception. */ public function removeAttribute($name = NULL) { if (GagawaUtil::gagawaIsEmpty($name)) { throw new Exception("Attribute name cannot " . "be empty!"); } for ($i = 0; $i < count($this->attributes_); $i++) { $attribute = $this->attributes_[$i]; if ($attribute->getName() === $name) { unset($this->attributes_[$i]); return true; } } // Couldn't find the attribute, so // it wasn't removed. return false; }
public function __construct($xmlns = NULL) { parent::__construct("html"); if (!GagawaUtil::gagawaIsEmpty($xmlns)) { $this->setXmlns($xmlns); } }