Пример #1
0
 /**
  * 
  * @param \import\Token $new
  */
 public function replaceToken(\import\Token $new)
 {
     $old = $this->tokens->item($new->getId() - 1);
     $new = $this->dom->importNode($new->getNode(), true);
     $old->parentNode->replaceChild($new, $old);
 }
Пример #2
0
 /**
  * 
  * @param \import\Token $new
  */
 public function replaceToken(\import\Token $new)
 {
     if ($new->getId() != $this->token->getId()) {
         throw new \RuntimeException('Only current token can be replaced when you are using XMLReader token iterator');
     }
     $old = $this->token->getNode();
     $new = $old->ownerDocument->importNode($new->getNode(), true);
     $old->parentNode->replaceChild($new, $old);
 }