public function textAfter($text = null) { if (isset($text)) { $textNode = $this->document->createTextNode($text); return $this->after($textNode); } $buffer = ''; foreach ($this->matches as $m) { $n = $m; while (isset($n->nextSibling) && $n->nextSibling->nodeType == XML_TEXT_NODE) { $n = $n->nextSibling; $buffer .= $n->textContent; } } return $buffer; }