Ejemplo n.º 1
0
 public function replaceElement(Element $oldElement, Element $newElement)
 {
     $body = str_replace($oldElement->getPlaceholder(), $newElement->getPlaceholder(), $this->body, $count);
     if ($count === 0) {
         throw new QtiModelException('cannot find the element to be replaced');
     } else {
         if ($count > 1) {
             throw new QtiModelException('multiple placeholder found for the element to be replaced');
         }
     }
     $this->removeElement($oldElement);
     $this->setElement($newElement, $body);
 }
 protected function replaceNode(DOMElement $node, Element $element)
 {
     $placeholder = $this->data->createTextNode($element->getPlaceholder());
     $node->parentNode->replaceChild($placeholder, $node);
 }