You are here

public function QueryPath::textAfter in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/QueryPath.php \QueryPath::textAfter()
  2. 7.2 QueryPath/QueryPath.php \QueryPath::textAfter()

File

QueryPath/QueryPath.php, line 1280

Class

QueryPath

Code

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;
}