You are here

public function QueryPath::text in QueryPath 7.3

Same name and namespace in other branches
  1. 6 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;
}