You are here

public function QueryPath::text in QueryPath 6

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

File

QueryPath/QueryPath.php, line 1251

Class

QueryPath

Code

public function text($text = NULL) {
  if (isset($text)) {
    $this
      ->removeChildren();
    $textNode = $this->document
      ->createTextNode($text);
    foreach ($this->matches as $m) {
      $m
        ->appendChild($textNode);
    }
    return $this;
  }
  $buf = '';
  foreach ($this->matches as $m) {
    $buf .= $m->textContent;
  }
  return $buf;
}